~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tsort.py

  • Committer: John Arbash Meinel
  • Date: 2009-08-17 15:26:18 UTC
  • mto: (4593.5.21 1.19-known-graph-sorted)
  • mto: This revision was merged to the branch mainline in revision 4620.
  • Revision ID: john@arbash-meinel.com-20090817152618-3547nakodq02savp
Change merge_sort to increase indent even for trivial merge histories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
545
545
                    if not left_subtree_pushed_stack[-1]:
546
546
                        # recurse depth first into the primary parent
547
547
                        next_node_name = pending_parents_stack[-1].pop(0)
 
548
                        is_left_subtree = True
 
549
                        left_subtree_pushed_stack[-1] = True
548
550
                    else:
549
551
                        # place any merges in right-to-left order for scheduling
550
552
                        # which gives us left-to-right order after we reverse
554
556
                        # display nicely (you get smaller trees at the top
555
557
                        # of the combined merge).
556
558
                        next_node_name = pending_parents_stack[-1].pop()
 
559
                        is_left_subtree = False
557
560
                    if next_node_name in completed_node_names:
558
561
                        # this parent was completed by a child on the
559
562
                        # call stack. skip it.
570
573
                        # this indicates a cycle.
571
574
                        raise errors.GraphCycleError(node_name_stack)
572
575
                    next_merge_depth = 0
573
 
                    if left_subtree_pushed_stack[-1]:
 
576
                    if is_left_subtree:
574
577
                        # a new child branch from name_stack[-1]
 
578
                        next_merge_depth = 0
 
579
                    else:
575
580
                        next_merge_depth = 1
576
 
                    else:
577
 
                        next_merge_depth = 0
578
 
                        left_subtree_pushed_stack[-1] = True
579
581
                    next_merge_depth = (
580
582
                        node_merge_depth_stack[-1] + next_merge_depth)
581
583
                    push_node(