Wednesday, April 6, 2011

How to quarantine a specific subversion revision?

I have a revision that has been committed to SVN trunk which I would like to roll back. However, I would like to retain the changes in some fashion such as a branch or even a patch file. Any suggestions?

From stackoverflow
  • Reverse-merge (I think that was the term), commit and that's all.

    For the "reverse-merge" part - TSVN has this cool feature called "Revert to this revision" (and "Revert changes from this revision"), accessible through the Log dialogue.

    The main purpose of a VCS is to keep history of your changes. You could always go back to this particular revision by using "Update to revision..." or by using the aforementioned "shortcuts".

    Oleg Barshay : And would I reinstate the changes at a later date?
    Greg Hewgill : You can restore the changes by reverting the previous revert.
    Oleg Barshay : Makes sense, thank you.
    cagcowboy : This just saved my life :-)
    Mike C. : Odd - I don't see the "Revert to this revision" option. Is there a security setting that could hide this option from me?
    Mike C. : @myself, I was going in through the Repo Browser, which is why the option was not available.
  • You can specify a particular revision when you do a copy (ie. branch).

    Something like:

    svn copy -rsome_revision trunk branches/interesting_branch
    

    So roll back your changes in your trunk and then do your branch, specifying the revision before you commited your rollback (merge).

    You can also capture the differences as a patch file, if that's what you really want to do, by redirecting the output of an svn diff to a text file. But that's usually not necessary, as the subversion merge commands give you this flexibility already.

0 comments:

Post a Comment