~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 16:35:07 UTC
  • mto: This revision was merged to the branch mainline in revision 4629.
  • Revision ID: john@arbash-meinel.com-20090817163507-0j9tdamcybwqu8rn
Add tests that we detect GraphCycleError

Turned out to be quite important, because otherwise KnownGraph.merge_sort()
ends up in an infinite loop w/ a GraphCycle.
(unlike topo_sort which pretty much just ignores those nodes.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
606
606
                        # current search stack (but not completed or we would
607
607
                        # have hit the continue 4 lines up.
608
608
                        # this indicates a cycle.
609
 
                        raise errors.GraphCycleError(node_name_stack)
 
609
                        if next_node_name in self._original_graph:
 
610
                            raise errors.GraphCycleError(node_name_stack)
 
611
                        else:
 
612
                            # This is just a ghost parent, ignore it
 
613
                            continue
610
614
                    next_merge_depth = 0
611
615
                    if is_left_subtree:
612
616
                        # a new child branch from name_stack[-1]