[Pkg-bazaar-commits] ./bzr/unstable r419: - RemoteBranch.__str__ and repr
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 07:52:13 UTC 2009
------------------------------------------------------------
revno: 419
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-05-09 18:47:06 +1000
message:
- RemoteBranch.__str__ and repr
- Better code for locating root of remote branch
modified:
bzrlib/commands.py
bzrlib/remotebranch.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2005-05-09 08:27:49 +0000
+++ b/bzrlib/commands.py 2005-05-09 08:47:06 +0000
@@ -965,7 +965,9 @@
return 2
except Exception, e:
quiet = False
- if isinstance(e, IOError) and e.errno == errno.EPIPE:
+ if (isinstance(e, IOError)
+ and hasattr(e, 'errno')
+ and e.errno == errno.EPIPE):
quiet = True
msg = 'broken pipe'
else:
=== modified file 'bzrlib/remotebranch.py'
--- a/bzrlib/remotebranch.py 2005-05-09 08:33:14 +0000
+++ b/bzrlib/remotebranch.py 2005-05-09 08:47:06 +0000
@@ -28,9 +28,10 @@
import gzip
from sets import Set
from cStringIO import StringIO
+import urllib2
from errors import BzrError, BzrCheckError
-from branch import Branch
+from branch import Branch, BZR_BRANCH_FORMAT
from trace import mutter
# velocitynet.com.au transparently proxies connections and thereby
@@ -77,7 +78,15 @@
while True:
try:
ff = get_url(url + '/.bzr/branch-format')
+
+ fmt = ff.read()
ff.close()
+
+ fmt = fmt.rstrip('\r\n')
+ if fmt != BZR_BRANCH_FORMAT.rstrip('\r\n'):
+ raise BzrError("sorry, branch format %r not supported at url %s"
+ % (fmt, url))
+
return url
except urllib2.URLError:
pass
@@ -92,14 +101,17 @@
class RemoteBranch(Branch):
- def __init__(self, baseurl, find_root=False, lock_mode='r'):
+ def __init__(self, baseurl, find_root=True, lock_mode='r'):
"""Create new proxy for a remote branch."""
if lock_mode not in ('', 'r'):
raise BzrError('lock mode %r is not supported for remote branches'
% lock_mode)
-
- self.baseurl = baseurl
- self._check_format()
+
+ if find_root:
+ self.baseurl = _find_remote_root(baseurl)
+ else:
+ self.baseurl = baseurl
+ self._check_format()
def __str__(self):
return '%s(%r)' % (self.__class__.__name__, self.baseurl)
More information about the Pkg-bazaar-commits
mailing list