Help with RemoteBzrDir.open_branch()
Neil Martinsen-Burrell
nmb at wartburg.edu
Mon Apr 25 04:20:18 UTC 2011
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/".
even though:
$ ssh remote.example.com
remote$ bzr info /Users/nmb/tmp/blech/.bzr/branches/trunk
Repository branch (format: 2a)
Location:
shared repository: tmp/blech/.bzr/branches
repository branch: tmp/blech/.bzr/branches/trunk
remote$ bzr info /Users/nmb/tmp/blech
Lightweight checkout (format: 2a)
Location:
light checkout root: tmp/blech
checkout of branch: tmp/blech/.bzr/branches/trunk
shared repository: tmp/blech/.bzr/branches
and:
$ bzr info bzr+ssh://remote.example.com/Users/nmb/tmp/blech/.bzr/branches/trunk
Repository branch (format: unnamed)Location:
shared repository:
bzr+ssh://quaggy-e.mooo.info/Users/nmb/tmp/blech/.bzr/branches/
repository branch:
bzr+ssh://quaggy-e.mooo.info/Users/nmb/tmp/blech/.bzr/branches/trunk/
$ bzr info bzr+ssh://quaggy-e.mooo.info/Users/nmb/tmp/blech
$ # Is it odd that bzr info returns nothing for remote working trees?
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.
-Neil
More information about the bazaar
mailing list