Rev 3147: Fix handling of ghost revisions in KnitParentsProvider (abentley) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jan 2 04:25:52 GMT 2008


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

------------------------------------------------------------
revno: 3147
revision-id:pqm at pqm.ubuntu.com-20080102042542-13ocbo4243mov89j
parent: pqm at pqm.ubuntu.com-20071228175832-9kboqtkemnuzzlab
parent: aaron.bentley at utoronto.ca-20071230021310-yl7qy9u957ne2u9j
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-01-02 04:25:42 +0000
message:
  Fix handling of ghost revisions in KnitParentsProvider (abentley)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
    ------------------------------------------------------------
    revno: 3146.1.1
    revision-id:aaron.bentley at utoronto.ca-20071230021310-yl7qy9u957ne2u9j
    parent: pqm at pqm.ubuntu.com-20071228175832-9kboqtkemnuzzlab
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: parents-provider-fix
    timestamp: Sat 2007-12-29 21:13:10 -0500
    message:
      Fix bad ghost handling in KnitParentsProvider
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
=== modified file 'NEWS'
--- a/NEWS	2007-12-26 21:13:53 +0000
+++ b/NEWS	2007-12-30 02:13:10 +0000
@@ -70,6 +70,10 @@
    * Fix traceback when sending large response bodies over the smart protocol
      on Windows. (Andrew Bennetts, #115781)
 
+   * _KnitParentsProvider.get_parent_map now handles requests for ghosts
+     correctly, instead of erroring or attributing incorrect parents to ghosts.
+     (Aaron Bentley)
+
    * pycurl authentication handling was broken and incomplete. Fix handling of
      user:pass embedded in the urls.
      (Vincent Ladeuil, #177643)

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2007-12-18 19:42:10 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2007-12-30 02:13:10 +0000
@@ -75,7 +75,7 @@
                 try:
                     parents = self._knit.get_parents_with_ghosts(revision_id)
                 except errors.RevisionNotPresent:
-                    pass
+                    continue
                 else:
                     if len(parents) == 0:
                         parents = [_mod_revision.NULL_REVISION]

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2007-12-21 22:34:12 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2007-12-30 02:13:10 +0000
@@ -526,6 +526,18 @@
         self.addCleanup(repo.unlock)
         repo.get_graph()
 
+    def test_graph_ghost_handling(self):
+        tree = self.make_branch_and_tree('here')
+        tree.lock_write()
+        self.addCleanup(tree.unlock)
+        tree.commit('initial commit', rev_id='rev1')
+        tree.add_parent_tree_id('ghost')
+        tree.commit('commit-with-ghost', rev_id='rev2')
+        graph = tree.branch.repository.get_graph()
+        parents = graph.get_parent_map(['ghost', 'rev2'])
+        self.assertTrue('ghost' not in parents)
+        self.assertEqual(tuple(parents['rev2']), ('rev1', 'ghost'))
+
     def test_implements_revision_graph_can_have_wrong_parents(self):
         """All repositories should implement
         revision_graph_can_have_wrong_parents, so that check and reconcile can




More information about the bazaar-commits mailing list