/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-04 03:52:13 UTC
  • mfrom: (1551.19.15 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20071204035213-2kot5u403spjchen
Merge warns when criss-cross encountered + docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
315
315
            common_walker.start_searching(new_common)
316
316
        return candidate_heads
317
317
 
318
 
    def find_unique_lca(self, left_revision, right_revision):
 
318
    def find_unique_lca(self, left_revision, right_revision,
 
319
                        count_steps=False):
319
320
        """Find a unique LCA.
320
321
 
321
322
        Find lowest common ancestors.  If there is no unique  common
326
327
 
327
328
        Note that None is not an acceptable substitute for NULL_REVISION.
328
329
        in the input for this method.
 
330
 
 
331
        :param count_steps: If True, the return value will be a tuple of
 
332
            (unique_lca, steps) where steps is the number of times that
 
333
            find_lca was run.  If False, only unique_lca is returned.
329
334
        """
330
335
        revisions = [left_revision, right_revision]
 
336
        steps = 0
331
337
        while True:
 
338
            steps += 1
332
339
            lca = self.find_lca(*revisions)
333
340
            if len(lca) == 1:
334
 
                return lca.pop()
 
341
                result = lca.pop()
 
342
                if count_steps:
 
343
                    return result, steps
 
344
                else:
 
345
                    return result
335
346
            if len(lca) == 0:
336
347
                raise errors.NoCommonAncestor(left_revision, right_revision)
337
348
            revisions = lca