Roll back or revert entire svn repository to an older revision

前端 未结 14 1349
时光取名叫无心
时光取名叫无心 2020-12-04 06:53

I messed up on my SVN repository and now need to revert the entire repository from revision 28 to 24 and don\'t want to deal with diffs or conflicts. Is there a quick and si

相关标签:
14条回答
  • 2020-12-04 07:16

    For anyone using TortoiseSVN, the solution is simple:

    • view change log
    • right-click the revision you want to roll back to...
    • ...select "Revert to this revision"
    • commit your changes

    This method preserves the version history (i.e. all of the revisions that you reverted).

    0 讨论(0)
  • 2020-12-04 07:17

    Could you svn del the topmost directories, then svn copy them:

    svn copy svnurl@version svnurl 
    
    0 讨论(0)
  • 2020-12-04 07:30

    Check out svnadmin dump/load. It creates a text file with every version of your files. It may be possible to delete everything above/below a certain point and re-import it.

    See for instance Migrating Repository Data Elsewhere

    0 讨论(0)
  • 2020-12-04 07:30

    If you do not avail admin rights then you cannot obliterate any old revisions BUT you can still hide them extremely well with just one amazingly simple "svn copy" command (nickf and JesperE already mentioned this but in a rather cryptic way)

    svn delete protocol://svnserver/some/resource
    svn copy protocol://svnserver/some/resource@24 protocol://svnserver/some/resource

    And that's it, revisions 25 to 28 have completely disappeared from svn log. It's not a hack at all, it is a safe and (barely...) documented feature.

    If "resource" is a directory then you must strip it from the last URL:

    svn copy protocol://svnserver/some/directory@24 protocol://svnserver/some/

    (otherwise you would copy it inside itself)

    0 讨论(0)
  • 2020-12-04 07:30

    I hate to say this, but that is a situation where I've found myself using backups of my svn repository.

    Can you copy files of a certain revision to a new directory within the repository?

    0 讨论(0)
  • 2020-12-04 07:31

    I'm not entirely sure if this work as I haven't used it in a live production yet, but I just now tried on a test repository (I copied one of my production ones) and it seems to work.

    When you're in your repository, use the following command:

    svn update -r 24 trunk
    

    Where 24 is the revision number, and trunk is the file/folder you'd like to update (or restore, in this case) to said revision number.

    In my test, several files were updated and (re-)added, and after doing a commit I did not receive any warnings whatsoever. I then modified a file with some dummy text and tried yet another commit, and only said file popped up on the modified list. So it seems to work rather well!

    Again, I didn't use this before in live productions, so if I'm wrong please advice. I'd love to know if this is the way to go, too, because I can see myself needing this in the (near) future.

    -Dave

    0 讨论(0)
提交回复
热议问题