~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Aaron Bentley
  • Date: 2010-08-15 14:52:10 UTC
  • mto: (5365.6.7 annotate-revspec)
  • mto: This revision was merged to the branch mainline in revision 5443.
  • Revision ID: aaron@aaronbentley.com-20100815145210-w1qr4lba53r3kghg
Extract iter_lefthand_ancestry from Repository.iter_ancestry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2511
2511
            ancestors will be traversed.
2512
2512
        """
2513
2513
        graph = self.get_graph()
2514
 
        next_id = revision_id
2515
 
        while True:
2516
 
            if next_id in (None, _mod_revision.NULL_REVISION):
2517
 
                return
2518
 
            try:
2519
 
                parents = graph.get_parent_map([next_id])[next_id]
2520
 
            except KeyError:
2521
 
                raise errors.RevisionNotPresent(next_id, self)
2522
 
            yield next_id
2523
 
            if len(parents) == 0:
2524
 
                return
2525
 
            else:
2526
 
                next_id = parents[0]
 
2514
        stop_revisions = (None, _mod_revision.NULL_REVISION)
 
2515
        return graph.iter_lefthand_ancestry(revision_id, stop_revisions)
2527
2516
 
2528
2517
    def is_shared(self):
2529
2518
        """Return True if this repository is flagged as a shared repository."""