Rev 4974: (mbp) Some reprs to help with debugging and interactive use in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jan 20 16:47:52 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4974 [merge]
revision-id: pqm at pqm.ubuntu.com-20100120164749-d4mdz4g4jpl866mt
parent: pqm at pqm.ubuntu.com-20100120142103-3omnefl6aio9bs0y
parent: mbp at sourcefrog.net-20100115072646-y3r8fposq8gtgt5t
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2010-01-20 16:47:49 +0000
message:
(mbp) Some reprs to help with debugging and interactive use
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/client.py client.py-20061116014825-2k6ada6xgulslami-1
bzrlib/smart/medium.py medium.py-20061103051856-rgu2huy59fkz902q-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2010-01-11 05:58:22 +0000
+++ b/bzrlib/remote.py 2010-01-20 16:47:49 +0000
@@ -114,6 +114,9 @@
self._probe_bzrdir()
+ def __repr__(self):
+ return '%s(%r)' % (self.__class__.__name__, self._client)
+
def _probe_bzrdir(self):
medium = self._client._medium
path = self._path_for_remote_call(self._client)
=== modified file 'bzrlib/smart/client.py'
--- a/bzrlib/smart/client.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/smart/client.py 2010-01-15 06:55:33 +0000
@@ -36,6 +36,9 @@
else:
self._headers = dict(headers)
+ def __repr__(self):
+ return '%s(%r)' % (self.__class__.__name__, self._medium)
+
def _send_request(self, protocol_version, method, args, body=None,
readv_body=None, body_stream=None):
encoder, response_handler = self._construct_protocol(
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py 2009-12-21 17:00:29 +0000
+++ b/bzrlib/smart/medium.py 2010-01-15 07:26:46 +0000
@@ -749,6 +749,9 @@
self._password = password
self._port = port
self._username = username
+ # for the benefit of progress making a short description of this
+ # transport
+ self._scheme = 'bzr+ssh'
# SmartClientStreamMedium stores the repr of this object in its
# _DebugCounter so we have to store all the values used in our repr
# method before calling the super init.
@@ -758,17 +761,18 @@
self._vendor = vendor
self._write_to = None
self._bzr_remote_path = bzr_remote_path
- # for the benefit of progress making a short description of this
- # transport
- self._scheme = 'bzr+ssh'
def __repr__(self):
- return "%s(connected=%r, username=%r, host=%r, port=%r)" % (
+ if self._port is None:
+ maybe_port = ''
+ else:
+ maybe_port = ':%s' % self._port
+ return "%s(%s://%s@%s%s/)" % (
self.__class__.__name__,
- self._connected,
+ self._scheme,
self._username,
self._host,
- self._port)
+ maybe_port)
def _accept_bytes(self, bytes):
"""See SmartClientStreamMedium.accept_bytes."""
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2010-01-11 05:58:22 +0000
+++ b/bzrlib/tests/test_remote.py 2010-01-20 16:47:49 +0000
@@ -134,6 +134,10 @@
b = BzrDir.open_from_transport(self.transport).open_branch()
self.assertStartsWith(str(b), 'RemoteBranch(')
+ def test_remote_bzrdir_repr(self):
+ b = BzrDir.open_from_transport(self.transport)
+ self.assertStartsWith(str(b), 'RemoteBzrDir(')
+
def test_remote_branch_format_supports_stacking(self):
t = self.transport
self.make_branch('unstackable', format='pack-0.92')
More information about the bazaar-commits
mailing list