Is "bzr push" safe?

Stephen J. Turnbull stephen at xemacs.org
Wed Nov 30 03:14:34 UTC 2011


Patrick Doyle writes:

 > Thank you for your reply.  But now I'm confused (because I fully
 > expected the answer to be "that was a flaw that was corrected in
 > version X.Y).

No, it's inherent in the way DAGs are constructed, and bzr computes
revision numbers.

 > When I read the documentation for "bzr push", it says that it only
 > works for branches that have not diverged.  I assumed that meant I can
 > only change a destination branch via "push" by appending to it, making
 > the "append_revisions_only" directive superfluous.
 > 
 > It would seem that I'm misunderstanding something here.

[[ Urk ... it seems Martin just gave an equivalent answer, but since
this is already written, I'll send it anyway.  If you fully understood
Martin's answer, maybe you should just throw this message away. :-) ]]

You are.  When you do a merge you do this to the DAG:

                  A        A
                 /        / \
                0    =>  0   C
                 \        \ /
                  B        B

The question is, is C = A + B or is C = B + A?  Although in arithmetic
the answer is "they're the same", in merging it is different.  If
version 0 is r100, then when A is the "left-hand parent" A is r101, C
is r102, and B is r100.1.  When B is the "left-hand parent", A is
r100.1, B is r101, and C is r102.  Note that the numbering of A and B
"flip-flops".  This can be disconcerting in any VCS, but especially so
in bzr which "hides" dotted revisions by default (A and B can actually
be long sequences of revisions, including merges -- if what developers
perceive as the "mainline" flops and becomes dotted revisions, it
seems like a lot of work "just disappears" -- panic city!)

If A and B are neighboring directories, then "cd A; bzr merge ../B;
bzr commit" gives C = A + B, and "cd B; bzr merge ../A; bzr commit"
gives C = B + A.

If in the case of C = A + B, you do "cd A; bzr push remote-A-URL",
then you only append revisions to the remote branch A.  With C = B + A
where you do "cd B; bzr push remote-A-URL" (same remote URL), not only
do you append revisions to branch A, but you *also force renumbering of
existing revisions* (thus it's not "append-only" -- I don't think the
name is really intuitive, but I don't have a better suggestion either).




More information about the bazaar mailing list