tags:

views:

13

answers:

2

Someone has inadvertently renamed a file in an SVN working copy by deleting the old one and adding the renamed file, instead of using the proper SVN rename command. Changes have continued to be made to the new file, but unfortunately the history is now broken. Unless you know where to look, you wouldn't even know that this is a problem.

Is there any way for me to re-link the history of the old file and the new file?

A: 

How many changes has been performed?

My solution would be:

  1. Delete current file
  2. Copy the latest version N of the file that was deleted with: svn copy -r N proto://path/to/file.ext file.ext
  3. Rename it with proper svn rename
  4. Reapply each diff, that has been done with "new" file (if it is not so important - you also can get only one big diff between "first rev of new file" and "last rev of new file"
zerkms
A: 

There is no straight forward way to do this in subversion. Actually subversion developers have been debating a lot (without a consensus) on this topic. In your case what you need is just to skip the specific revisions which caused the delete and rename. You can look for more on this topic if you search for subversion obliterate. This link has a howto on this topic.

Note: Unless done carefully you might end up in trouble. Also make sure you maintain the UID while doing the dump and load, else developers will have to do a switch to the updated repo.

Version Control Buddy
"skip the specific revisions which caused the delete and rename" - but what about subsequent changes to the new file?
detly
It would still be there, only the specific revisions has to be skipped. For example if the file was modified in these revisions r3, r5,r6,r12,r15. If r5 and r6 is where the delete and add happened, then you can svndump filter to skip revisions r5 and r6 alone. That way you will still have the rest of the changes.this link(http://serverfault.com/questions/95083/svnadmin-dump-skip-revision) discusses about a similar problem.
Version Control Buddy