bzr switch --force failing with ConnectionError

Bug #395980 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

 affects bzr
 status triaged
 importance medium
 done

Root cause:
 - ConnectionError is raised when probing for a branch.
 - switch catches NotBranchError, but not ConnectionError

possible fixes:
 - catch ConnectionError in Remote* and raise NotBranchError
 - catch ConnectionError in cmd_switch.

I need to think more about it, but I'm inclined to say that the
RemoteBranch logic should be catching ConnectionError.

-Rob

$ bzr -Derror switch --no-plugins --force
bzr://mbp:9990/.bzr-repo/trunk/
bzr: ERROR: bzrlib.errors.ConnectionError: Connection error: failed to connect to mbp:4155: Connection refused

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 729, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 924, in run_bzr
    ret = run(*run_argv)
  File "/Library/Python/2.6/site-packages/bzrlib/commands.py", line 560, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Library/Python/2.6/site-packages/bzrlib/builtins.py", line 5175, in run
    branch = control_dir.open_branch()
  File "/Library/Python/2.6/site-packages/bzrlib/bzrdir.py", line 1713, in open_branch
    return format.open(self, _found=True, ignore_fallbacks=ignore_fallbacks)
  File "/Library/Python/2.6/site-packages/bzrlib/branch.py", line 1950, in open
    location, possible_transports=possible_transports)
  File "/Library/Python/2.6/site-packages/bzrlib/bzrdir.py", line 837, in open
    return BzrDir.open_from_transport(t, _unsupported=_unsupported)
  File "/Library/Python/2.6/site-packages/bzrlib/bzrdir.py", line 872, in open_from_transport
    return format.open(transport, _found=True)
  File "/Library/Python/2.6/site-packages/bzrlib/bzrdir.py", line 2053, in open
    return self._open(transport)
  File "/Library/Python/2.6/site-packages/bzrlib/bzrdir.py", line 3280, in _open
    return remote.RemoteBzrDir(transport, self)
  File "/Library/Python/2.6/site-packages/bzrlib/remote.py", line 112, in __init__
    response = self._call('BzrDir.open', path)
  File "/Library/Python/2.6/site-packages/bzrlib/remote.py", line 56, in _call
    return self._client.call(method, *args)
  File "/Library/Python/2.6/site-packages/bzrlib/smart/client.py", line 129, in call
    result, protocol = self.call_expecting_body(method, *args)
  File "/Library/Python/2.6/site-packages/bzrlib/smart/client.py", line 142, in call_expecting_body
    method, args, expect_response_body=True)
  File "/Library/Python/2.6/site-packages/bzrlib/smart/client.py", line 87, in _call_and_read_response
    readv_body=readv_body, body_stream=body_stream)
  File "/Library/Python/2.6/site-packages/bzrlib/smart/client.py", line 60, in _send_request
    encoder.call(method, *args)
  File "/Library/Python/2.6/site-packages/bzrlib/smart/protocol.py", line 1235, in call
    self._write_end()
  File "/Library/Python/2.6/site-packages/bzrlib/smart/protocol.py", line 1106, in _write_end
    self.flush()
  File "/Library/Python/2.6/site-packages/bzrlib/smart/protocol.py", line 1073, in flush
    self._real_write_func(''.join(self._buf))
  File "/Library/Python/2.6/site-packages/bzrlib/smart/medium.py", line 390, in accept_bytes
    self._accept_bytes(bytes)
  File "/Library/Python/2.6/site-packages/bzrlib/smart/medium.py", line 908, in _accept_bytes
    self._medium._accept_bytes(bytes)
  File "/Library/Python/2.6/site-packages/bzrlib/smart/medium.py", line 823, in _accept_bytes
    self._ensure_connection()
  File "/Library/Python/2.6/site-packages/bzrlib/smart/medium.py", line 870, in _ensure_connection
    (self._host, port, err_msg))
ConnectionError: Connection error: failed to connect to mbp:4155: Connection refused

--

Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
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.