Rev 3483: Start returning the common node when we encounter it. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/lazy_revno
John Arbash Meinel
john at arbash-meinel.com
Mon Jun 16 23:39:31 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/lazy_revno
------------------------------------------------------------
revno: 3483
revision-id: john at arbash-meinel.com-20080616223912-e8lkrvyhgzveif90
parent: john at arbash-meinel.com-20080616223044-9b6g2so40tf0d70v
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: lazy_revno
timestamp: Mon 2008-06-16 17:39:12 -0500
message:
Start returning the common node when we encounter it.
-------------- next part --------------
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py 2008-06-16 22:30:44 +0000
+++ b/bzrlib/graph.py 2008-06-16 22:39:12 +0000
@@ -1456,7 +1456,6 @@
def __init__(self, parent_provider, tip_revision_id, tip_revno):
assert isinstance(tip_revno, int)
self._parent_provider = parent_provider
- self.get_parent_map = self._parent_provider.get_parent_map
self._tip_revision_id = tip_revision_id
tip_node = _LazyRevnoNode(tip_revision_id)
@@ -1518,7 +1517,8 @@
cur_node = node
node_ancestors = set([node.revision_id])
while cur_node is not None and next_parent_request:
- parent_map = self.get_parent_map(next_parent_request)
+ parent_map = self._parent_provider.get_parent_map(
+ next_parent_request)
self._update_known_children(parent_map)
next_parent_request = set()
@@ -1539,10 +1539,9 @@
next_mainline_node.set_merged_into(revno)
for merged_revision_id in next_mainline_parents[1:]:
node = self._get_node(merged_revision_id)
- # If this is a direct merge, then we have the final merge
- # value. Otherwise, the merge would have said "nothing to
- # do".
- # TODO: factor this into node.set_merged_into???
+ # If this is a direct merge, then we have the final
+ # merge value. Otherwise, the merge would have said
+ # "nothing to do".
node.set_merged_into(revno)
self._cur_mainline_node = next_mainline_node
if next_mainline_tip in node_ancestors:
@@ -1551,7 +1550,7 @@
# TODO: We could walk the nodes right here, and set the
# revnos for entries that we have already started
# processing.
- break
+ return next_mainline_node
cur_parent_ids = parent_map.get(cur_node.revision_id, None)
next_node = None
@@ -1574,5 +1573,7 @@
if cur_node.revno is not None:
# We have a node where we know the revno, so we will know the
# mainline revno involved.
- break
+ return cur_node
cur_node = next_node
+ # XXX: If we got this far, what should we do?
+ assert False, "I don't know how I got here, or what error to raise"
=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py 2008-06-16 22:30:44 +0000
+++ b/bzrlib/tests/test_graph.py 2008-06-16 22:39:12 +0000
@@ -1385,4 +1385,7 @@
mapper = self.make_mapper(with_tail, 'i', break_on=['a', 'b'])
# The node walker should reach mainline before the mainline walker
# does. We should still be able to stop early
- mapper._find_boundary_revisions(mapper._get_node('g'))
+ node = mapper._find_boundary_revisions(mapper._get_node('g'))
+ # The common point is 'e'
+ self.assertEqual('e', node.revision_id)
+ self.assertEqual(5, node.revno)
More information about the bazaar-commits
mailing list