Rev 3455: Add a test case for the first loop, unable to find a way to trigger the second loop in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/mpdiffs_235687

John Arbash Meinel john at arbash-meinel.com
Thu May 29 15:40:31 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/mpdiffs_235687

------------------------------------------------------------
revno: 3455
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
-------------- next part --------------
=== modified file 'bzrlib/tests/test_versionedfile.py'
--- a/bzrlib/tests/test_versionedfile.py	2008-05-12 02:40:40 +0000
+++ b/bzrlib/tests/test_versionedfile.py	2008-05-29 14:40:07 +0000
@@ -542,6 +542,11 @@
             self.assertEqualDiff(vf.get_text(version),
                                  new_vf.get_text(version))
 
+    def test_make_mpdiffs_with_ghosts(self):
+        vf = self.get_file('foo')
+        vf.add_lines_with_ghosts('text', ['ghost'], ['line\n'])
+        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-29 14:39:33 +0000
+++ b/bzrlib/versionedfile.py	2008-05-29 14:40:07 +0000
@@ -266,6 +266,10 @@
                 parents = [lines[p] for p in parent_map[version_id] if p in
                     knit_versions]
             except KeyError:
+                # 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,



More information about the bazaar-commits mailing list