Recording where branches that are absent are
Robert Collins
robertc at robertcollins.net
Wed Feb 1 22:30:09 GMT 2006
On Wed, 2006-02-01 at 16:40 -0500, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Robert Collins wrote:
> > With the current design of recording this in the
> > working tree we can have inconsistent states like:
> >
> > .bzr/workingtree has a branch pointer to a remote location
> > .bzr/branch has a branch
>
> So, now that we've determined that repository, branch and working tree
> are separable, you're now unconfortable with the notion of them being
> entirely separate.
>
> I don't see this as an inconsistent state, just a weird one.
I'm entirely comfortable with them being separate. I'm not comfortable
with designing in failure modes we dont want.
> > I think a huge advantage of this would be to make that impossible - not
> > illegal, actually impossible.
>
> I don't think your doing this has any such effect, unless you've got
> different branch formats for these types.
The .bzr/branch/format file would be different yes, and the fact they
both occupy .bzr/branch/* would have that effect.
> >>| If the branch-location was in the checkout, then the only way you could
> >>| find there was a distant branch would be to create a working tree
> >>| instance and then look at its branch property.
> ...
> >>Also, what you propose entails creating two Branch objects
> ...
> > Not at all.
> > BzrDirFormat7 [supporting split out repo/branch/checkout] when asked to
> > open a branch will do
> > branch_transport = self.transport.clone('branch')
> > format = BranchFormat.find_format(branch_transport)
> > # [compatability checks here if needed]
> > format.open(branch_transport)
> >
> > format is a factory - if the detected format on disk is a
> > 'BranchReference', then the constructed and returned branch would be a
> > real branch from the target url - there would be no instance of an
> > unreal or pseudo branch constructed at all.
>
> Similarly, you don't actually need a WorkingTree object in order to
> produce a branch from .bzr/checkout/branch-location
Yes you do need a working tree object, because reading anything other
than the format file from within .bzr/checkout is an abstraction
violation.
I'll note sparately that we could also use a decorator to lock the local
branch control dir from changes to prevent any race conditions, without
changing the behaviour of the api.
> > with respect to potential cycles, I would not expect this to forward,
> > that is a reference could not be a reference to a reference.
>
> In order to implement that, you will need Branch.open_really. I would
> prefer that Branch.open_really was named Branch.open.
Huh? I don't understand why you would need that.
bzrdir = BzrDir.open(referenced_url)
format = BranchFormat.find_format(bzrdir)
if isinstance(format, BranchPointerFormat):
raise ChainedBranchReferences(self)
> >>I see 'location of the branch' as a property of the WorkingTree. It
> >>will be manipulated by working tree commands, and will affect the
> >>behavior of the WorkingTree alone. As a WorkingTree property, the way
> >>it is represented should be subject to the checkout-format.
> >
> >
> > I see it as a property of the .bzr control dir - we should only ever
> > have one branch associated with a .bzr dir and this enforces that by
> > recording *either* a branch *or* a reference, but not both.
>
> I don't think it makes sense to have a .bzr/branch directory, if it does
> not contain a branch. I don't think you've shown that we should never
> have both a branch and a branch reference. Even if you do, it is quite
> easy to enforce that rule without messing up the conceptual layout.
I think its much harder to enforce that rule when the data storage
permits it to be broken.
I think the damage of having a working tree pointing to a branch that is
not the one present locally is pretty clear - code that grabs branches
directly will consistently have different information than the working
tree does.
I dont understand your objection to having the branch api manage whether
the branch is local or not. I know you dont think it makes sense - but I
dont know *why* you think that.
Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060202/75e7f4cd/attachment.pgp
More information about the bazaar
mailing list