Rev 4320: (jml) Raise NoSuchRevision from fetch, instead of InstallFailed in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri May 1 09:51:07 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4320
revision-id: pqm at pqm.ubuntu.com-20090501085103-kq2uocvhxzjex06k
parent: pqm at pqm.ubuntu.com-20090501073309-ysq34enbsw9avhyw
parent: andrew.bennetts at canonical.com-20090501075902-evil2r4edle6qx4d
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-05-01 09:51:03 +0100
message:
  (jml) Raise NoSuchRevision from fetch, instead of InstallFailed
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
  bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
    ------------------------------------------------------------
    revno: 4316.1.7
    revision-id: andrew.bennetts at canonical.com-20090501075902-evil2r4edle6qx4d
    parent: jml at canonical.com-20090501064411-ju02bqt2b8fuq211
    parent: pqm at pqm.ubuntu.com-20090501073309-ysq34enbsw9avhyw
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: such-a-shame
    timestamp: Fri 2009-05-01 17:59:02 +1000
    message:
      Merge from bzr.dev, resolving a conflict.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/bzrdir.py         bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
      bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      doc/en/user-guide/installing_bazaar.txt installing_bazaar.tx-20071114035000-q36a9h57ps06uvnl-4
    ------------------------------------------------------------
    revno: 4316.1.6
    revision-id: jml at canonical.com-20090501064411-ju02bqt2b8fuq211
    parent: jml at canonical.com-20090501064230-kyk7v49xt8cevd25
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: such-a-shame
    timestamp: Fri 2009-05-01 16:44:11 +1000
    message:
      Update the NEWS file.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 4316.1.5
    revision-id: jml at canonical.com-20090501064230-kyk7v49xt8cevd25
    parent: jml at canonical.com-20090501064143-sau7sklin075c06l
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: such-a-shame
    timestamp: Fri 2009-05-01 16:42:30 +1000
    message:
      Remove InstallFailed, it's not needed anymore.
    modified:
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
    ------------------------------------------------------------
    revno: 4316.1.4
    revision-id: jml at canonical.com-20090501064143-sau7sklin075c06l
    parent: jml at canonical.com-20090501064102-fkzry0ykqyo8u7u6
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: such-a-shame
    timestamp: Fri 2009-05-01 16:41:43 +1000
    message:
      Unused import
    modified:
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
    ------------------------------------------------------------
    revno: 4316.1.3
    revision-id: jml at canonical.com-20090501064102-fkzry0ykqyo8u7u6
    parent: jml at canonical.com-20090501063640-0tdu53i1hmkvui5o
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: such-a-shame
    timestamp: Fri 2009-05-01 16:41:02 +1000
    message:
      Don't bother wrapping the NoSuchRevision in an InstallFailed.
    modified:
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
    ------------------------------------------------------------
    revno: 4316.1.2
    revision-id: jml at canonical.com-20090501063640-0tdu53i1hmkvui5o
    parent: jml at canonical.com-20090501063354-y9ombke3ky2e0jvz
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: such-a-shame
    timestamp: Fri 2009-05-01 16:36:40 +1000
    message:
      News update ftw.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 4316.1.1
    revision-id: jml at canonical.com-20090501063354-y9ombke3ky2e0jvz
    parent: pqm at pqm.ubuntu.com-20090430150023-1cw4lwqf312vpuu8
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: such-a-shame
    timestamp: Fri 2009-05-01 16:33:54 +1000
    message:
      Don't raise InstallFailed from fetch. Instead let the search_missing_revision_ids error bubble up.
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
=== modified file 'NEWS'
--- a/NEWS	2009-05-01 05:32:20 +0000
+++ b/NEWS	2009-05-01 07:59:02 +0000
@@ -67,6 +67,10 @@
 API Changes
 ***********
 
+* ``InterPackRepo.fetch`` and ``RepoFetcher`` now raise ``NoSuchRevision``
+  instead of ``InstallFailed`` when they detect a missing revision.
+  ``InstallFailed`` itself has been deleted. (Jonathan Lange)
+
 Internals
 *********
 

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2009-04-24 05:08:51 +0000
+++ b/bzrlib/errors.py	2009-05-01 06:42:30 +0000
@@ -1227,15 +1227,6 @@
             not_ancestor_id=not_ancestor_id)
 
 
-class InstallFailed(BzrError):
-
-    def __init__(self, revisions):
-        revision_str = ", ".join(str(r) for r in revisions)
-        msg = "Could not install revisions:\n%s" % revision_str
-        BzrError.__init__(self, msg)
-        self.revisions = revisions
-
-
 class AmbiguousBase(BzrError):
 
     def __init__(self, bases):

=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2009-04-29 04:14:26 +0000
+++ b/bzrlib/fetch.py	2009-05-01 07:59:02 +0000
@@ -30,8 +30,6 @@
     errors,
     symbol_versioning,
     )
-from bzrlib.errors import InstallFailed
-from bzrlib.progress import ProgressPhase
 from bzrlib.revision import NULL_REVISION
 from bzrlib.tsort import topo_sort
 from bzrlib.trace import mutter
@@ -170,12 +168,9 @@
         if self._last_revision is NULL_REVISION:
             # explicit limit of no revisions needed
             return None
-        try:
-            return self.to_repository.search_missing_revision_ids(
-                self.from_repository, self._last_revision,
-                find_ghosts=self.find_ghosts)
-        except errors.NoSuchRevision, e:
-            raise InstallFailed([self._last_revision])
+        return self.to_repository.search_missing_revision_ids(
+            self.from_repository, self._last_revision,
+            find_ghosts=self.find_ghosts)
 
     def _parent_inventories(self, revision_ids):
         # Find all the parent revisions referenced by the stream, but

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-04-29 04:14:26 +0000
+++ b/bzrlib/repository.py	2009-05-01 07:59:02 +0000
@@ -3453,11 +3453,8 @@
             # nothing to do:
             return (0, [])
         else:
-            try:
-                revision_ids = self.search_missing_revision_ids(revision_id,
-                    find_ghosts=find_ghosts).get_keys()
-            except errors.NoSuchRevision:
-                raise errors.InstallFailed([revision_id])
+            revision_ids = self.search_missing_revision_ids(revision_id,
+                find_ghosts=find_ghosts).get_keys()
             if len(revision_ids) == 0:
                 return (0, [])
         return self._pack(self.source, self.target, revision_ids)

=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py	2009-04-24 05:08:51 +0000
+++ b/bzrlib/tests/test_errors.py	2009-05-01 06:42:30 +0000
@@ -114,15 +114,6 @@
             "read without data loss.",
             str(error))
 
-    def test_install_failed(self):
-        error = errors.InstallFailed(['rev-one'])
-        self.assertEqual("Could not install revisions:\nrev-one", str(error))
-        error = errors.InstallFailed(['rev-one', 'rev-two'])
-        self.assertEqual("Could not install revisions:\nrev-one, rev-two",
-                         str(error))
-        error = errors.InstallFailed([None])
-        self.assertEqual("Could not install revisions:\nNone", str(error))
-
     def test_jail_break(self):
         error = errors.JailBreak("some url")
         self.assertEqualDiff("An attempt to access a url outside the server"

=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py	2009-04-29 04:14:26 +0000
+++ b/bzrlib/tests/test_fetch.py	2009-05-01 07:59:02 +0000
@@ -95,9 +95,9 @@
     br_a3.fetch(br_a2, br_a.revision_history()[2])
     # pull the 3 revisions introduced by a at u-0-3
     br_a3.fetch(br_a2, br_a.revision_history()[3])
-    # InstallFailed should be raised if the branch is missing the revision
+    # NoSuchRevision should be raised if the branch is missing the revision
     # that was requested.
-    self.assertRaises(errors.InstallFailed, br_a3.fetch, br_a2, 'pizza')
+    self.assertRaises(errors.NoSuchRevision, br_a3.fetch, br_a2, 'pizza')
 
     # TODO: Test trying to fetch from a branch that points to a revision not
     # actually present in its repository.  Not every branch format allows you




More information about the bazaar-commits mailing list