~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Aaron Bentley
  • Date: 2007-07-26 19:56:04 UTC
  • mto: This revision was merged to the branch mainline in revision 2657.
  • Revision ID: abentley@panoramicfeedback.com-20070726195604-707eq8fs9px91yjc
correctly handle Graph.is_ancestor(x, x)

Show diffs side-by-side

added added

removed removed

Lines of Context:
300
300
        active_descendant = True
301
301
        while (active_ancestor or active_descendant):
302
302
            common = set()
 
303
            if active_descendant:
 
304
                try:
 
305
                    nodes = descendant_walker.next()
 
306
                except StopIteration:
 
307
                    active_descendant = False
 
308
                else:
 
309
                    if candidate_ancestor in nodes:
 
310
                        return True
 
311
                    common.update(nodes.intersection(ancestor_walker.seen))
303
312
            if active_ancestor:
304
313
                try:
305
314
                    nodes = ancestor_walker.next()
309
318
                    if candidate_descendant in nodes:
310
319
                        return False
311
320
                    common.update(nodes.intersection(descendant_walker.seen))
312
 
            if active_descendant:
313
 
                try:
314
 
                    nodes = descendant_walker.next()
315
 
                except StopIteration:
316
 
                    active_descendant = False
317
 
                else:
318
 
                    if candidate_ancestor in nodes:
319
 
                        return True
320
 
                    common.update(nodes.intersection(ancestor_walker.seen))
321
321
            try:
322
322
                common.update(common_walker.next())
323
323
            except StopIteration: