views:

235

answers:

3

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.

A: 

From TortoiseSVN Help http://tortoisesvn.net/node/351

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.

Sergey Mirvoda
I don't think this is what he was asking.
M4N
Why not? just revert deletion and addition and repair move. hm ... loosing all history
Sergey Mirvoda
+1  A: 

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.

M4N
+1  A: 

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.
Kevin Reid