SVN fix folder move done wrong
Someone at my work moved a folder to a different location. But he didn't do a proper SVN move, he just added them as new files and deleted the old files. This of course meant the history of items are wrong. I was away at the time and several edits have happened on the files since, so reverting the revisions and redoing the operation myself is out.
Is there a way I can fix this up so SVN becomes aware of their full history?
开发者_StackOverflowP.S. I use tortoiseSVN.
It is not possible to edit the content of the history of a Subversion repository. You must either:
- rebuild the repository starting from the pre-mistake revision, committing a correct move, and then committing the revisions from after that. This requires everyone to get new working copies, or rewind them (
svn update -rN
) to before the revisions that are going to be replaced. - Delete the moved folder, recreate it as a copy of the old folder (
svn copy <url of old dir>@<old rev> <new name in wc>
), then usesvn merge
to reapply the changes since then to the new copy of the old-location folder.
This is from the TortoiseSVN FAQ:
If you have already committed the deleted file, then you can use the repository browser, change to the revision where the file still existed and then use the command Copy to... from the context menu. Enter the path to your working copy as the target and the deleted file will be copied from the repository to your working copy.
You can also restore a deleted directory using this technique.
Of course, you have to delete (or rename) the folder added by your colleague first.
From TortoiseSVN Help http://tortoisesvn.net/repairmoves.html
Moving and renaming versioned files inside a working copy must always be done with the corresponding Subversion/TortoiseSVN commands. A move/rename without those (e.g., with the Windows Explorer) leads to problems since Subversion doesn't know that you have moved/renamed the files.
For example, if you rename a file named myfile.txt to myfile2.txt without using the Subversion/TortoiseSVN command, myfile.txt will show up as "missing" and myfile2.txt as "non-versioned" in the commit dialog or the Check-For-Modifications dialog.
If that happens to you, TortoiseSVN offers you an easy way to correct this.
As I know this is only way to repair move, Not sure about move_and_then_added though.
精彩评论