Results 1 to 12 of 12

Thread: Does Subversion keeps file history after move or rename?

  1. #1

    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. #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.

  3. #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!

  4. #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.)

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

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

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

  7. #7
    Quote 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.

  8. #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?

  9. #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

  10. #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.

  11. #11
    Quote 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.

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

Similar Threads

  1. Does svn move preserve history or not?
    By jake in forum Version Control Practices
    Replies: 2
    Last Post: 03-07-2013, 08:30 PM
  2. history and move with tksvn
    By j_rmx in forum General Setup and Troubleshooting
    Replies: 0
    Last Post: 01-30-2010, 10:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •