Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In subversion, someone deleted a file and added it back with changes in a single commit, how do I fix this?

Tags:

svn

Someone made a single subversion commit that delete a file, and added a new file with the same name, that consists of the original files along with ~155 new lines.

(I have no idea how they managed to do this.)

Now 'svn log' only shows the history going back to that commit, and I have to jump through hoops if I want to diff revisions of that file from before and after the point in time that they did this. (E.g. 'svn diff url@oldrev url@newrev' instead of 'svn diff -r n:m')

A handful of commits have been made to this file after this happened. (Around 3).

How can I fix this?

I'm using the command line 'svn' client on Linux.

like image 637
Tim Avatar asked Nov 04 '22 10:11

Tim


1 Answers

Mightymuke is actually right:

Here are the instructions:

  1. note all revisions of the new created file (I call them R1 .. to Rn)
  2. note revision when original file was deleted(I call it Rd)
  3. check out working copy with at least this file
  4. delete new file and commit change and state in commit message that File was added wrong in commit R1 (state the revision and make sure everybody can understand why it was wrong added)
  5. make an update of your workingcopy ('svn update')
  6. if using tortoiseSVN, use show log and locate Rd in history, click on it and right click on the deleted file and choose "Revert changes from this revision" Do not use this on the whole revision, because then you would undo other changes as well. On other OSes use a reverse merge for this("-c-Rd" means for example "-c-50" if 50 was revision of your deleted file):

    svn merge -c-Rd

  7. copy the current file contents from the deleted file into the revived on and commit(state the undoing Revisions R2..Rn in your commit message). Alternative: you can recreate each of the old revisions and commit them separately(state the original revision R2...Rn in each commit message)

like image 82
Peter Parker Avatar answered Nov 08 '22 03:11

Peter Parker