Recovering from a failed copy of "svn"

This afternoon, noticing a broken build and the fact that some files looked like very old versions (about 2 weeks old), I checked the svn log. Apparently just this afternoon one of the developers made a "svn copy" from a directory from the old version to the same directory. So it seems that the latest "ie head" version of all files in this directory is really old, and the whole "ie log" history is even older.

However, I think I can recover by using another "svn copy" (ie disease is a cure). What I'm looking at is finding the version where the bad "svn copy" was made (eg rev 1234), subtracting 1 (1233) and doing:

svn copy -r 1233 file://path/to/messed/up/dir file://path/to/messed/up/dir

      

This should restore the latest version as well as bring back my entire history. Am I right about this?

+1


source to share


3 answers


According to the SVN book ,

svn merge -c -1234

      

must do the trick.



Here's a whole lot about it in the book.

Detailed explanation: -c -1234

converts to -r 1234:1233

, which returns the change from version 1234.

+7


source


This copy command does not work for two reasons:

  • since the target directory already exists, svn treats the copy request as a copy to the target directory; you cannot overwrite cp. So this will create the file / dir / dir. When the version of the HEAD directory was created, there had to be a delete operation first.
  • this is a request to copy version 1233 of the HEAD object up to /dir.However, the dir object in HEAD was not revision 1233; an object with the same path that had such a revision has been deleted.


To fix this you need

  • delete the current dir object:

    svn rm file:///path/to/messed/up/dir
    
          

  • Copy using "binding changes"

    svn cp file:///path/to/messed/up/dir@1233 file:///path/to/messed/up
    
          

+1


source


Possibly, but back up first.

In fact, I am left wondering why you don't have a daily backup that you can simply restore from ... Is your SVN repository surely important enough for this?

-2


source







All Articles