[MERGE][#291046] Fix pushing an unstackable branch + stackable repo when there is a default stacking policy.

Andrew Bennetts andrew.bennetts at canonical.com
Tue Dec 16 04:26:41 GMT 2008


Hi,

This patch fixes a bug when pushing a new stacked branch.  The bug causes a push
to a newly created branch to trip over Martin's change to raise BzrCheckError
when finishing a pack.

The specific issue is that if a source branch is not in a stackable format,
*and* the source repo is in a stackable format, *and* the destination has a
default stacking branch, then the repository is created with only the stacked
data, but the new branch is still an unstacked branch.  This initial push
succeeds, then the next push that modifies a file not modified in the stacked
repository fails, because the compression parent is missing.

The correct fix I think is to behave as if the command-line had said --stacked
--stacked-on=foo, i.e. upgrade the choice of branch format we create if stacking
is requested.  So this patch does this.

It adds a branch_implementation test *and* a blackbox test.  These tests are
essentially the same, so perhaps the blackbox one is redundant.  But for some
reason I feel a bit nervous about this (the BzrDir.clone code is such a mess),
so I left it in.  If you have any comments on appropriate tests for this, I'd be
happy to hear them.  I also feel like the tests could be a little clearer, but
it is a somewhat complex set of circumstances that is required to exercise this
bug.

I also had to change BzrBranch (i.e. format 5) to not do a full history sync in
_synchronize_history if the destination isn't also format 5.  This is because
the target branch at that point *doesn't* have the fallback repositories set
(even though it is format 7), so the histories won't match because the
destination is mostly ghosts.  This in turn is because the destination branch
has reopened the destination repository, rather than re-using the already
constructed one made by the BzrDir earlier (which has the fallback set).  Fixing
this would be great (as it will remove a wasted reconnection and other
duplicated work), but is fairly involved.  The tweak to _synchronize_history was
much simpler, and probably has positive performance implications anyway, even
though it does fix this issue more by accident than design.

-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: broken-stacking-fix-3911.patch
Type: text/x-diff
Size: 19044 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081216/03b0af8f/attachment-0001.bin 


More information about the bazaar mailing list