open_branch() on a remote lightweight checkout tries to open a local branch

Bug #772123 reported by Neil Martinsen-Burrell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

When trying to open the parent branch of a checkout on a remote machine using the bzrlib API, I tried:

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
$

I expected to get a branch on the remote sever that I could interact with.

It even seems that if there is a branch on the local machine at /Users/nmb/tmp/blech, then the open_branch call will work but it will return the local branch.

Revision history for this message
John A Meinel (jameinel) wrote :

The ReferenceLocation is being stored as an absolute path, and is probably even a file:// url. We certainly have talked about changing it to a relative URL segment when reasonable (../other/location rather than always /path/to/other/location).

summary: - RemoteBzrDir.open_branch() fails on remote checkouts
+ open_branch() on a remote lightweight checkout tries to open a local
+ branch
Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.