making checkouts, branches and repositories on disk - and the whole naming debate
Robert Collins
robertc at robertcollins.net
Tue Jan 24 21:49:40 GMT 2006
On Tue, 2006-01-24 at 15:31 -0600, John Arbash Meinel wrote:
> Robert Collins wrote:
> > On Tue, 2006-01-24 at 14:57 -0600, John Arbash Meinel wrote:
> >
> >>Robert Collins wrote:
> >
> >
> >>Right now we handle this by using WorkingTree.open_containing versus
> >>Branch.open_containing. We use the former if we know that we need a
> >>working tree, and the latter if we just need branch information.
> >>However, we end up with code duplication (the open containing loop).
> >
> >
> > And if we need 'the first thing found' - we currently search for a
> > branch and then open the tree at the branch if desired. This is ok today
> > while branches always co-exist but it wont be very very soon.
> >
>
> Well, if we have a checkout, 'the first thing found' should find that,
> and then return the associated branch.
Erm, I think my point was missed.
Say we have a function like status that needs either a branch or a tree.
If it uses Branch.open_containing, should that skip up past a working
tree to a branch ? I.e. if ~ is versioned and ~/source/foo is a
checkout of something else.
I thing Branch.open_containing should just skip past working trees
without branches.
If it uses WorkingTree.open_containing - should that skip past branches
without trees ? I think it should - imagine if you have a ~ versioned
and in ~/branches/ you have a bunch of treeless branches.
So then status cannot usefully use *either* of those two functions. It
needs a new one that stops at *either a branch or a tree*.
> >>I wouldn't mind seeing something that just understood
> >>'.bzr/branch-format' (and the future '.bzr/meta-format'). And this could
> >>then be called by all other functions.
> >
> >
> > MetaTree.open_containing ?
> >
> > that will work too, but I suspect we will have a bunch of duplicate code
> > building on this.
> >
> > Rob
> >
>
> Well, WorkingTree.open_containing just tries to do return
> WorkingTree(path) once it finds something.
> So a future version would be:
>
> class WorkingTree(...):
> def open_containing(path):
> base_path, tail = MetaTree.open_containing(path)
> return WorkingTree(base_path), tail
>
> That isn't a lot of duplicate code.
The duplicate code I'm worried about is in the all the commands that
need either a tree or a branch, or other such permutations.
> But really we want something which parses all of the branch format stuff
> and returns at least version objects, if not the final branch itself.
> I'm not sure how you are doing it in your branch-format stuff.
BzrBranchFormat.find_format(transport)
thats certainly a component of the solution.
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/20060125/48e841ff/attachment.pgp
More information about the bazaar
mailing list