O'Reilly logo

Version Control with Subversion, 2nd Edition by Brian W. Fitzpatrick, Ben Collins-Sussman, C. Michael Pilato

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Blocking Changes

Sometimes there’s a particular changeset that you don’t want to be automatically merged. For example, perhaps your team’s policy is to do new development work on /trunk, but to be more conservative about backporting changes to a stable branch you use for releasing to the public. On one extreme, you can manually cherrypick single changesets from the trunk to the branch—just the changes that are stable enough to pass muster. Maybe things aren’t quite that strict, though; perhaps most of the time you’d like to just let svn merge automatically merge most changes from trunk to branch. In this case, you’d like a way to mask a few specific changes out, that is, prevent them from ever being automatically merged.

In Subversion 1.5, the only way to block a changeset is to make the system believe that the change has already been merged. To do this, one can invoke a merge command with the --record-only option:

$ cd my-calc-branch

$ svn propget svn:mergeinfo .
/trunk:1680-3305

# Let's make the metadata list r3328 as already merged.
$ svn merge -c 3328 --record-only http://svn.example.com/repos/calc/trunk

$ svn status
M     .

$ svn propget svn:mergeinfo .
/trunk:1680-3305,3328

$ svn commit -m "Block r3328 from being merged to the branch."
...

This technique works, but it’s also a little bit dangerous. The main problem is that we’re not clearly differentiating between the ideas of I don’t want this change and I already have this change. We’re effectively lying to the system, making ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required