Rev 4616: Change merge_sort to increase indent even for trivial merge histories. in http://bazaar.launchpad.net/~jameinel/bzr/2.0b1-merge-sort
John Arbash Meinel
john at arbash-meinel.com
Mon Aug 17 16:26:29 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.0b1-merge-sort
------------------------------------------------------------
revno: 4616
revision-id: john at arbash-meinel.com-20090817152618-3547nakodq02savp
parent: pqm at pqm.ubuntu.com-20090815123000-raj3s1ovqhy4abfs
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0b1-merge-sort
timestamp: Mon 2009-08-17 10:26:18 -0500
message:
Change merge_sort to increase indent even for trivial merge histories.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_tsort.py'
--- a/bzrlib/tests/test_tsort.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/test_tsort.py 2009-08-17 15:26:18 +0000
@@ -211,7 +211,7 @@
self.assertSortAndIterate(graph, 'F',
[(0, 'F', 0, (3,), False),
(1, 'D', 1, (2,2,1), False),
- (2, 'C', 1, (2,1,1), True), # XXX: Shouldn't it be merge_depth=2?
+ (2, 'C', 2, (2,1,1), True),
(3, 'B', 0, (2,), False),
(4, 'A', 0, (1,), True),
], True)
=== modified file 'bzrlib/tsort.py'
--- a/bzrlib/tsort.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tsort.py 2009-08-17 15:26:18 +0000
@@ -545,6 +545,8 @@
if not left_subtree_pushed_stack[-1]:
# recurse depth first into the primary parent
next_node_name = pending_parents_stack[-1].pop(0)
+ is_left_subtree = True
+ left_subtree_pushed_stack[-1] = True
else:
# place any merges in right-to-left order for scheduling
# which gives us left-to-right order after we reverse
@@ -554,6 +556,7 @@
# display nicely (you get smaller trees at the top
# of the combined merge).
next_node_name = pending_parents_stack[-1].pop()
+ is_left_subtree = False
if next_node_name in completed_node_names:
# this parent was completed by a child on the
# call stack. skip it.
@@ -570,12 +573,11 @@
# this indicates a cycle.
raise errors.GraphCycleError(node_name_stack)
next_merge_depth = 0
- if left_subtree_pushed_stack[-1]:
+ if is_left_subtree:
# a new child branch from name_stack[-1]
+ next_merge_depth = 0
+ else:
next_merge_depth = 1
- else:
- next_merge_depth = 0
- left_subtree_pushed_stack[-1] = True
next_merge_depth = (
node_merge_depth_stack[-1] + next_merge_depth)
push_node(
More information about the bazaar-commits
mailing list