[BUG][0.12] 'bzr init' creates branches incompatibile with bzr-0.11

Martin Pool mbp at canonical.com
Tue Oct 17 09:01:00 BST 2006

On 17 Oct 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> Because of this bug in bzr-0.11, it seems we need to only create trees
> with unique roots after we bump the disk formats for working tree and
> repository. We already have RepositoryKnit2 almost ready to go, we just
> need to update WorkingTree as well (WorkingTree4, in essence, just
> changes the .bzr/checkout/inventory to be a format=6 inventory).

Just to digress a little on the general approach to formats: the general
rule is that we should only write into a version X object the same data
that would have been written by previous releases that also handled
version X.  Otherwise it's just too hard to be sure that things we've
written out can actually be read back safely, without getting into
fairly complicated testing of data between different versions.

(It might be good to test that systematically - do a blackbox test that
makes a branch with version 0.12 and then tries to check it out with
every previous version.  But even then we will probably not get so much
coverage of the data format as we do with our current approach.)

> I think it is a little late to do this sort of format bump for bzr-0.12,
> so I'm proposing this simple fix:
> === modified file 'bzrlib/workingtree.py'
> --- bzrlib/workingtree.py       2006-10-16 01:13:59 +0000
> +++ bzrlib/workingtree.py       2006-10-17 07:35:17 +0000
> @@ -2100,7 +2100,7 @@
>          branch = a_bzrdir.open_branch()
>          if revision_id is None:
>              revision_id = branch.last_revision()
> -        inv = Inventory(root_id=gen_root_id())
> +        inv = Inventory()
>          wt = WorkingTree3(a_bzrdir.root_transport.local_abspath('.'),
>                           branch,
>                           inv,
> This should keep bzr-0.12 from creating new branches that bzr-0.11
> cannot handle.

+1 from me, though I would really like to get input from Aaron since
this is his area.  However, I do take your point that people can create
difficult repositories this way so if you want to fix it first and talk
about it later it's ok with me.

As you say, given that 0.11 cannot accomodate a root id here, we will
need a new workingtree and repository format to bring this in.  It's
your call as RM whether this can be done for 0.12.  Since we're before
RC and it would hopefully be a small change it might be OK.  But on the
other hand perhaps it should be combined with any other format changes
we want for 0.13.

More information about the bazaar mailing list