Rev 6293: (jelmer) Cope with NoSuchRevision errors during ``Repository.gather_stats`` in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Fri Nov 25 10:52:42 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6293 [merge]
revision-id: pqm at pqm.ubuntu.com-20111125105242-da32o819atgqlerb
parent: pqm at pqm.ubuntu.com-20111124175022-so5nve7kjo1p8stx
parent: jelmer at samba.org-20111124175342-wjtwhxqe205eqbvm
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-11-25 10:52:42 +0000
message:
  (jelmer) Cope with NoSuchRevision errors during ``Repository.gather_stats``
   HPSS call. (Jelmer Vernooij)
modified:
  bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
  bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py	2011-11-18 14:37:41 +0000
+++ b/bzrlib/smart/repository.py	2011-11-24 17:53:42 +0000
@@ -391,7 +391,11 @@
             decoded_committers = True
         else:
             decoded_committers = None
-        stats = repository.gather_stats(decoded_revision_id, decoded_committers)
+        try:
+            stats = repository.gather_stats(decoded_revision_id,
+                decoded_committers)
+        except errors.NoSuchRevision:
+            return FailedSmartServerResponse(('nosuchrevision', revid))
 
         body = ''
         if stats.has_key('committers'):

=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py	2011-11-22 11:20:10 +0000
+++ b/bzrlib/tests/test_smart.py	2011-11-24 17:53:42 +0000
@@ -1719,6 +1719,17 @@
                          request.execute('',
                                          rev_id_utf8, 'yes'))
 
+    def test_unknown_revid(self):
+        """An unknown revision id causes a 'nosuchrevision' error."""
+        backing = self.get_transport()
+        request = smart_repo.SmartServerRepositoryGatherStats(backing)
+        repository = self.make_repository('.')
+        expected_body = 'revisions: 0\n'
+        self.assertEqual(
+            smart_req.FailedSmartServerResponse(
+                ('nosuchrevision', 'mia'), None),
+            request.execute('', 'mia', 'yes'))
+
 
 class TestSmartServerRepositoryIsShared(tests.TestCaseWithMemoryTransport):
 

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-11-24 17:50:22 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-11-25 10:52:42 +0000
@@ -47,6 +47,9 @@
   remote ones. See ``bzr help configuration`` for more details.
   (Vincent Ladeuil, #843211)
 
+* Cope with missing revision ids being specified to
+  ``Repository.gather_stats`` HPSS call. (Jelmer Vernooij, #411290)
+
 * Fix test failures on windows related to locations.conf handling.
   (Vincent Ladeuil, #892992)
 




More information about the bazaar-commits mailing list