Managing multiple maintenance branches

Stephen J. Turnbull stephen at
Wed Apr 8 17:14:25 BST 2009

Russel Winder writes:

 > > Doesn't "bzr merge --revision=this..that" and/or "bzr merge
 > > --change=that" DTRT?
 > Probably.  Unfortunately, last time I tried using revision ranges I got

Ah, well, say so.  I would have been more helpful!

 > into a terrible tiz as it is not entirely clear whether the range is
 > inclusive or exclusive at either or both ends -- and doubt leads to
 > fear.

Yeah, IMO consistency would have been a better idea, and I think
exclusive->inclusive is best, even though inconvenient for log and not
entirely convincing for merge.  Probably too late to fix that now,
though.  So...

"bzr merge revision=5..7 ../foo" will try to ensure that revisions 6
and 7 from the ../foo branch are merged, but will not try to merge 5.
Ie, it's *exclusive* at the beginning of a range, but *inclusive* at
the end.

The funny wording is intended to be precise, including at least the
following caveats:

  - If 6 was previously merged, it won't try to do that again, but
    will try to merge 7 (assuming it wasn't merged before).
  - If 6 leads to a conflict, it will stop and let you sort it out
    before messing with 7.
  - *Nothing* gets committed until you tell bzr to do so.  This means
    you can just do "bzr revert" at any point to get back to sanity.

"Revision control means never having to say you're sorry." :-)

Here's a little script for fun-with-foo:

dofoo () {
  echo foo$1 >> foo$1;
  bzr add foo$1;
  bzr commit -m "do foo $1";
pushd /tmp
mkdir foo;cd foo; bzr init; dofoo 1
cd ..; bzr branch foo bar
cd ../foo; for i in 2 3 4 5 6 7 8; do dofoo $i; done
cd ../bar
bzr merge --revision=3..6 ../foo
bzr commit -m "merge 4 5 6"
bzr merge --revision=4..7 ../foo
bzr commit -m "merge 7"
bzr merge --revision=2..8 ../foo
bzr commit -m "merge 3 8"

Check that the commit logs are accurate, and I bet you'll feel better
about the whole idea.

 > output, but it certainly isn't alphabetic, nor even lexical.

"Dyslexical", I guess.  Er, sorry!  "But, Ma, I couldn't help myself!"

Anyway, hope your day gets better from here.

More information about the bazaar mailing list