[bug?] 'bzr branch lp:foo' doesn't work

Martin Pool mbp at canonical.com
Tue Feb 13 03:04:19 GMT 2007


On 12 Feb 2007, John Arbash Meinel <john at arbash-meinel.com> wrote:
> Currently if you do "bzr branch lp:foo" it fails, because it actually
> tries to branch from http://code.launchpad.net/foo to
> http://code.launchpad.net/foo

Yes I would say both that and the checkout failure are bugs.

> It does this because the code which determines the target name does:
> 
> if to_location is None:
>     to_location = os.path.basename(from_location.rstrip("/\\"))
> 
> And that will naturally not split on lp:foo (it works for lp:///foo).
> 
> One possibility is to switch from using 'from_location' to using:
> to_location = os.path.basename(br_from.base.rstrip('/'))

I don't think using br_from (the finally found branch) is the right
solution, as you discuss it gives somewhat confusing behaviour.  Rather
the problem is that we're assuming a url can be parsed by just looking
for slashes, which is dodgy.  We want to get the last non-empty
component of the path, or of the path part of the url.

> I wonder if we need to switch the 'lp:' prefix to be consistent with all
> of our other urls, or at least require a single slash "lp:/".
> 
> We could special case it, or include ':' as part of the path we would strip.

We could add a slash, but then for consistency it should be lp:/// which
starts to lose the conciseness.

> I think it adds to the slick-ness if "bzr branch lp:bzr" creates a 'bzr'
> directory in the local working directory.

Agree.

> Note, this effects more than just 'bzr branch', it also affects things
> like "bzr checkout" which does:
> % bzr checkout lp:bzr
> bzr: ERROR: http://bazaar.launchpad.net/~bzr/bzr/trunk/.bzr/ is not a
> local path.

That's a strange message if it's the same bug...

-- 
Martin



More information about the bazaar mailing list