Rev 3489: (Daniel Fischer) VersionedFile.make_mpdiffs() needs to raise the in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jun 9 22:16:54 BST 2008


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

------------------------------------------------------------
revno: 3489
revision-id:pqm at pqm.ubuntu.com-20080609211646-amc2rr2zi50omr8m
parent: pqm at pqm.ubuntu.com-20080609170811-rvmncl3uidae32bk
parent: john at arbash-meinel.com-20080609204820-llja7xdsn90zmgza
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-06-09 22:16:46 +0100
message:
  (Daniel Fischer) VersionedFile.make_mpdiffs() needs to raise the
  	right exception, (bug #235687)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
  bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
    ------------------------------------------------------------
    revno: 3453.3.4
    revision-id:john at arbash-meinel.com-20080609204820-llja7xdsn90zmgza
    parent: john at arbash-meinel.com-20080529144133-ilzj3ezed8469x6d
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: mpdiffs_235687
    timestamp: Mon 2008-06-09 15:48:20 -0500
    message:
      Skip the new test for old weave formats that don't support ghosts
    modified:
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
    ------------------------------------------------------------
    revno: 3453.3.3
    revision-id:john at arbash-meinel.com-20080529144133-ilzj3ezed8469x6d
    parent: john at arbash-meinel.com-20080529144007-k6wtk829yfhvaqt4
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: mpdiffs_235687
    timestamp: Thu 2008-05-29 09:41:33 -0500
    message:
      NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3453.3.2
    revision-id:john at arbash-meinel.com-20080529144007-k6wtk829yfhvaqt4
    parent: john at arbash-meinel.com-20080529143933-io78t2jvdpgtxyk4
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: mpdiffs_235687
    timestamp: Thu 2008-05-29 09:40:07 -0500
    message:
      Add a test case for the first loop, unable to find a way to trigger the second loop
    modified:
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
    ------------------------------------------------------------
    revno: 3453.3.1
    revision-id:john at arbash-meinel.com-20080529143933-io78t2jvdpgtxyk4
    parent: pqm at pqm.ubuntu.com-20080527013230-8qjaju10duxpy3e2
    author: Daniel Fischer <df at mysql.com>
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: mpdiffs_235687
    timestamp: Thu 2008-05-29 09:39:33 -0500
    message:
      Raise the right exception in make_mpdiffs (bug #235687)
    modified:
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
=== modified file 'NEWS'
--- a/NEWS	2008-06-09 16:29:51 +0000
+++ b/NEWS	2008-06-09 21:16:46 +0000
@@ -183,6 +183,9 @@
       under vim on Mac OS X.
       (Neil Martinsen-Burrell)
 
+    * ``VersionedFile.make_mpdiffs()`` was raising an exception that wasn't in
+      scope. (Daniel Fischer #235687)
+
   DOCUMENTATION:
 
     * Added directory structure and started translation of docs in spanish.

=== modified file 'bzrlib/tests/test_versionedfile.py'
--- a/bzrlib/tests/test_versionedfile.py	2008-06-04 07:47:17 +0000
+++ b/bzrlib/tests/test_versionedfile.py	2008-06-09 21:16:46 +0000
@@ -618,6 +618,15 @@
             self.assertEqualDiff(vf.get_text(version),
                                  new_vf.get_text(version))
 
+    def test_make_mpdiffs_with_ghosts(self):
+        vf = self.get_file('foo')
+        try:
+            vf.add_lines_with_ghosts('text', ['ghost'], ['line\n'])
+        except NotImplementedError:
+            # old Weave formats do not allow ghosts
+            return
+        self.assertRaises(errors.RevisionNotPresent, vf.make_mpdiffs, ['ghost'])
+
     def _setup_for_deltas(self, f):
         self.assertFalse(f.has_version('base'))
         # add texts that should trip the knit maximum delta chain threshold

=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py	2008-05-12 02:40:40 +0000
+++ b/bzrlib/versionedfile.py	2008-05-29 14:40:07 +0000
@@ -254,7 +254,7 @@
             try:
                 knit_versions.update(parent_map[version_id])
             except KeyError:
-                raise RevisionNotPresent(version_id, self)
+                raise errors.RevisionNotPresent(version_id, self)
         # We need to filter out ghosts, because we can't diff against them.
         knit_versions = set(self.get_parent_map(knit_versions).keys())
         lines = dict(zip(knit_versions,
@@ -266,7 +266,11 @@
                 parents = [lines[p] for p in parent_map[version_id] if p in
                     knit_versions]
             except KeyError:
-                raise RevisionNotPresent(version_id, self)
+                # I don't know how this could ever trigger.
+                # parent_map[version_id] was already triggered in the previous
+                # for loop, and lines[p] has the 'if p in knit_versions' check,
+                # so we again won't have a KeyError.
+                raise errors.RevisionNotPresent(version_id, self)
             if len(parents) > 0:
                 left_parent_blocks = self._extract_blocks(version_id,
                                                           parents[0], target)




More information about the bazaar-commits mailing list