Losing SVN history on files during refactoring

后端 未结 3 712
隐瞒了意图╮
隐瞒了意图╮ 2021-02-02 00:20

During some refactoring, I\'m moving files around. Obviously SVN sees this as deleting the file and creating a new one since the IDE doesn\'t trigger an SVN rename/move operatio

相关标签:
3条回答
  • 2021-02-02 00:56

    You could install the (free) visual studio add-in AnkhSVN. This will track your file-renames and you won't lose the history in subversion.

    File renames are tracked by the subversion client. If you rename files without using the subversion client (using windows explorer or visual studio solution explorer instead of TortoiseSVN or AnkhSVN), then subversion won't recognise the rename operation (only a delete and an add operation).

    BTW: using AnkhSVN gives you some other advantages, such as the displaying the subversion status of files directly in the solution explorer.

    Alternatively there's also VisualSVN, which is comparable to AnkhSVN, but is commercial.

    0 讨论(0)
  • 2021-02-02 00:59

    Tortoise defaults to Stop on copy when viewing logs.

    If you uncheck that box on the log viewer, then you'll be able to see the entire history of the files/directories.

    0 讨论(0)
  • 2021-02-02 01:03

    The SVN way to do this is actually to have SVN rename the file (svn move or using TortoiseSVN's "Rename"). However, if you absolutely must have some external tool to perform the rename operation, you can use TortoiseSVN to repair the move operation. The following will tell SVN that the new file is actually the renamed old one:

    1. Open the "Check for Modifications" Window.
    2. Mark both the old file name (listed as missing) and the new one (listed as unversioned)
    3. Right click this selection and chose "Repair Move".

    Note: I'm typing this from memory. It might not be fully correct. And there might be other ways to do this (like marking the files in the explorer).

    If you already lost the history on a file where you miss it badly, you could resurrect the old file (you do this by svn copying an old revision's version into its old place), merge the new file's history into it, then delete the new file, and svn move the old file to the new file's name.

    0 讨论(0)
提交回复
热议问题