Tuesday, September 28, 2010

Reverting & Arguing with already merged revisions in SVN

So for the last few days I've been merging a crap shoot of a collection of features that have intermingled revisions and a whole bunch of interdependencies.

This lead me to the point yesterday that I had to revert to an earlier version of the branch I've been working (and in the process lose an afternoon of work) so that I could merge another feature that had lots of changes I needed.

After eventually remembering how to go back to a previous version (Merge 2 different trees and select the From Revision as the latest revision on the branch and then select the To Revision as the version you want to go back to) I discovered another problem, I couldn't get the revisions that had already been merged to cooperate and re-merge into the branch because subversion thought that the revisions where all in there already.

After some unsuccessful searching on the net and trawling Stack Overflow I couldn't find anything useful. So I went off and poked around a little more before it occurred to that I could probably edit the properties on the branch. So I opened up the properties via the Tortoise SVN menu as shown to the left. And discovered there was a field that holds the merge history, svn:merginfo. The mergeinfo tag is organised by source branch and revision.

Once I'd found this it was a simple (albeit tedious) process to remove the revisions that I wanted to re-merge from the list and it was all good, they once again merged properly. Hope this tip helps you guys out.

Oh and I know that we should move to Git or Mercurial (aka hg) but it is going to take a while to get the whole company on board.

No comments:

Post a Comment