Announcement

Collapse
No announcement yet.

Does Subversion keeps file history after move or rename?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does Subversion keeps file history after move or rename?

    Hi all!
    A very simple question.
    Is it possible to make Subversion keep file history after move or rename?

    I've played around with a sample repository. And it appeared that the history got lost after the file was renamed or moved to another folder. I was using TortoiseSVN "Rename" and "Move versioned file" commands.
    After the operation completes, the log file contains only one message about file addition.

    I extensively use code refactoring in my project, which is all about moves and renames.
    It is very disappointing to lose vital history information because of a file name or location changed.

    Pasha

  • #2
    Hi,

    I'm not quite sure what you mean by loosing history. If a file named A exists in revision 1 of the repository and you rename the file to B then file B exists in revision 2 of the repository, but file A still exists in revision 1 of the repository.

    Comment


    • #3
      Hi!

      Yes you are right, from the technical point of view A and B are two different files. But for me personally it is the same file. For me it looks very convenient to consider the rename as a regular file change. Just like contents modification.

      I use Star Team at work. It copes with this issue pretty well.
      I can easily track back file modifications to the date of creation no matter was the file renamed or moved. This is the feature I want from Subversion.

      Thanks for the answer!

      Comment


      • #4
        I'm not sure what's going on with your test as Subversion does track history through file moves/renames/copies (I've just (re)confirmed that to myself using the command-line client). However, it must be done via an svn move, its synonym svn rename or svn copy. A simultaneous svn add and svn delete will break the history path. (Note that svn status' output is a little ambiguous for files so a svn move looks exactly how a svn add/delete would.)

        Comment


        • #5
          Plus, "atomic renames" are "right arounf the corner".

          Cheers, Mike5
          Miha Vitorovic
          Close the world, txEn eht nepO.

          Comment


          • #6
            lmop, mike5, thanks somuch!
            Looks like this is a TortoiseSVN client problem...

            Comment


            • #7
              Originally posted by repkin
              lmop, mike5, thanks somuch!
              Looks like this is a TortoiseSVN client problem...
              TSVN should handle it just fine as well. You're likely just missing a checkbox in the log dialog somewhere.
              I am neither an employee nor customer of WANDisco.

              Comment


              • #8
                Much thanks, however I'm still stuck.
                I have done the following simple experiment with Tortoise SVN to check whether the thing works.
                I have a file a.txt and a folder F.
                Both are located at the same level of folder hierarchy and are synchronized to Subversion.
                Then I move a.txt to F, using TortoiseSVN command "SVN move versioned files here".
                Next I look up the log for a.txt.
                There is actually a special checkbox named "Hide unrelated changed paths". I uncheck it.
                And then I see the following lines in the bottom table:
                Added /trunk/F/a.txt
                Deleted /trunk/a.txt

                Ok, now I want to look at the history for /trunk/a.txt.
                So I select /trunk/a.txt and choose "Show log" from the popup menu.
                And then I see the error message box that informs me that the file /trunk/a.txt was not found.
                This is how the story ends.
                I wasn't able to look at the history.

                Is it possible that my TortoiseSVN base is broken?

                Comment


                • #9
                  That sounds right to me. If you're looking at the HEAD revision or your uncommitted working copy, there is no file trunk/a.txt anymore (because its /trunk/F/a.txt), and you can't view a log for something that doesn't exist at the revision you're looking at.

                  Try getting the log of F/a.txt
                  I am neither an employee nor customer of WANDisco.

                  Comment


                  • #10
                    The log for /trunk/F/a.txt is poor it just contains a single record which tells that the file was removed and then added. However I wnat to see all the contents changes that were performed before the file was moved.

                    Thanks, anyway.

                    Comment


                    • #11
                      Originally posted by repkin
                      The log for /trunk/F/a.txt is poor it just contains a single record which tells that the file was removed and then added. However I wnat to see all the contents changes that were performed before the file was moved.
                      Disable "stop on copy" and you'll get the full log.

                      Subversion keeps full history of a file when it's moved, you're just not looking for it properly.
                      I am neither an employee nor customer of WANDisco.

                      Comment


                      • #12
                        Thank you so much, andyl, it works!! What a fool I am, it was so obvious. Sorry

                        Comment

                        Working...
                        X