Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

P.S. I use tortoiseSVN.

like image 985
Chris McGrath Avatar asked Feb 28 '10 22:02

Chris McGrath


3 Answers

It is not possible to edit the content of the history of a Subversion repository. You must either:

  1. 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.
  2. 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 use svn merge to reapply the changes since then to the new copy of the old-location folder.
like image 187
Kevin Reid Avatar answered Nov 13 '22 12:11

Kevin Reid


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.

like image 40
M4N Avatar answered Nov 13 '22 13:11

M4N


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.

like image 27
Sergey Mirvoda Avatar answered Nov 13 '22 13:11

Sergey Mirvoda