Help with RemoteBzrDir.open_branch()

Alexander Belchenko bialix at ukr.net
Mon Apr 25 05:41:13 UTC 2011


Neil Martinsen-Burrell пишет:
> I need some help with the Bazaar API.  I have a lightweight checkout
> on a remote machine (part of a colocated workspace) and I would like
> to get the branch object that it refers to.  My first try at this
> (which apparently has never worked: http://pad.lv/768784) was
> essentially
> 
> REMOTE = 'remote.example.com'
> from bzrlib import bzrdir
> a_bzrdir, relpath =
> bzrdir.BzrDir.open_containing('bzr+ssh://%s/Users/nmb/tmp/blech' %
> REMOTE)
> branch = a_bzrdir.open_branch()
> 
> which fails with
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "bzrlib/remote.py", line 584, in open_branch
>     location=response[1], ignore_fallbacks=ignore_fallbacks)
>   File "bzrlib/branch.py", line 2300, in open
>     location, possible_transports=possible_transports)
>   File "bzrlib/bzrdir.py", line 826, in open
>     return BzrDir.open_from_transport(t, _unsupported=_unsupported)
>   File "bzrlib/bzrdir.py", line 856, in open_from_transport
>     redirected)
>   File "bzrlib/transport/__init__.py", line 1666, in do_catching_redirections
>     return action(transport)
>   File "bzrlib/bzrdir.py", line 843, in find_format
>     transport, _server_formats=_server_formats)
>   File "bzrlib/controldir.py", line 752, in find_format
>     raise errors.NotBranchError(path=transport.base)
> bzrlib.errors.NotBranchError: Not a branch:
> "/Users/nmb/tmp/blech/.bzr/branches/trunk/".

> Any ideas on why open_branch() is telling me that something is not a
> branch, even though it clearly is?  The remote host runs bzr.dev r5809
> and the same on the client.  I think I am making a simple mistake
> here, but I can't figure out what it is.

absolute paths vs relative paths problem?

I think this is because light checkouts use absolute paths to point to
the real branch, and for colo workspace this is always local path. So,
IUC, bzr sees local path pointer to the branch and tries to open it on
your local machine, not on remote host.




More information about the bazaar mailing list