Rev 4656: (robertc) Pass IncompatibleRepositories error over the smart server. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Aug 27 02:34:51 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4656 [merge]
revision-id: pqm at pqm.ubuntu.com-20090827013447-ndjtt02ad7nfdoiy
parent: pqm at pqm.ubuntu.com-20090827005327-iky1i2fzwi75h4ie
parent: robertc at robertcollins.net-20090826023039-bhz639awyxq8bys2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-08-27 02:34:47 +0100
message:
(robertc) Pass IncompatibleRepositories error over the smart server.
(Robert Collins)
modified:
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/request.py request.py-20061108095550-gunadhxmzkdjfeek-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2009-08-21 05:48:59 +0000
+++ b/bzrlib/errors.py 2009-08-26 01:18:13 +0000
@@ -793,6 +793,12 @@
class IncompatibleRepositories(BzrError):
+ """Report an error that two repositories are not compatible.
+
+ Note that the source and target repositories are permitted to be strings:
+ this exception is thrown from the smart server and may refer to a
+ repository the client hasn't opened.
+ """
_fmt = "%(target)s\n" \
"is not compatible with\n" \
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2009-08-17 03:51:44 +0000
+++ b/bzrlib/remote.py 2009-08-26 01:18:13 +0000
@@ -2759,7 +2759,10 @@
'Missing key %r in context %r', key_err.args[0], context)
raise err
- if err.error_verb == 'NoSuchRevision':
+ if err.error_verb == 'IncompatibleRepositories':
+ raise errors.IncompatibleRepositories(err.error_args[0],
+ err.error_args[1], err.error_args[2])
+ elif err.error_verb == 'NoSuchRevision':
raise NoSuchRevision(find('branch'), err.error_args[0])
elif err.error_verb == 'nosuchrevision':
raise NoSuchRevision(find('repository'), err.error_args[0])
=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py 2009-08-14 00:55:42 +0000
+++ b/bzrlib/smart/request.py 2009-08-26 02:30:39 +0000
@@ -364,6 +364,9 @@
return ('FileExists', err.path)
elif isinstance(err, errors.DirectoryNotEmpty):
return ('DirectoryNotEmpty', err.path)
+ elif isinstance(err, errors.IncompatibleRepositories):
+ return ('IncompatibleRepositories', str(err.source), str(err.target),
+ str(err.details))
elif isinstance(err, errors.ShortReadvError):
return ('ShortReadvError', err.path, str(err.offset), str(err.length),
str(err.actual))
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2009-08-17 21:24:24 +0000
+++ b/bzrlib/tests/test_remote.py 2009-08-26 01:18:13 +0000
@@ -2668,6 +2668,13 @@
expected_error = errors.ReadError(path)
self.assertEqual(expected_error, translated_error)
+ def test_IncompatibleRepositories(self):
+ translated_error = self.translateTuple(('IncompatibleRepositories',
+ "repo1", "repo2", "details here"))
+ expected_error = errors.IncompatibleRepositories("repo1", "repo2",
+ "details here")
+ self.assertEqual(expected_error, translated_error)
+
def test_PermissionDenied_no_args(self):
path = 'a path'
translated_error = self.translateTuple(('PermissionDenied',), path=path)
More information about the bazaar-commits
mailing list