Rev 3526: Reproduce bzr.dev's numbering logic by filtering ghosts. (breaks tests) in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/lazy_revno

John Arbash Meinel john at arbash-meinel.com
Thu Aug 7 23:54:52 BST 2008


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

------------------------------------------------------------
revno: 3526
revision-id: john at arbash-meinel.com-20080807225443-9ofrmj521l9f92c0
parent: john at arbash-meinel.com-20080807204509-aqe2gj5ss2s6iry4
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: lazy_revno
timestamp: Thu 2008-08-07 17:54:43 -0500
message:
  Reproduce bzr.dev's numbering logic by filtering ghosts. (breaks tests)
-------------- next part --------------
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2008-08-07 20:45:09 +0000
+++ b/bzrlib/graph.py	2008-08-07 22:54:43 +0000
@@ -1468,6 +1468,7 @@
         self.descended_from = None
         self.mainline_revno = None
         self.merged_into = None
+        self.is_ghost = False
 
     def __repr__(self):
         return ('%s(%s, revno:%s desc:%s merged:%s mainline:%s'
@@ -1670,6 +1671,7 @@
                     # shortcut to NULL_REVISION which unifies the handling of
                     # ghosts and roots, which is how merge_sort behaves.
                     cur_parent_ids = (revision.NULL_REVISION,)
+                    cur_node.is_ghost = True
                     null_node = self._get_node(revision.NULL_REVISION)
                     null_node.known_children.add(cur_node.revision_id)
 
@@ -1838,6 +1840,7 @@
                         # have to do for _find_mainline_ancestor
                         null_node = self._get_node(revision.NULL_REVISION)
                         null_node.known_children.add(node.revision_id)
+                        node.is_ghost = True
                     node.parent_ids = next_parent_ids
 
                 if (not node.parent_ids or node.descended_from is not None
@@ -1995,6 +1998,8 @@
                 if parent_id in searching:
                     continue
                 parent_node = self._get_node(parent_id)
+                if parent_node.is_ghost:
+                    continue
                 searching.add(parent_id)
                 search_stack.append(parent_node)
 



More information about the bazaar-commits mailing list