~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Vincent Ladeuil
  • Date: 2011-06-27 15:42:09 UTC
  • mfrom: (5993 +trunk)
  • mto: (5993.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5994.
  • Revision ID: v.ladeuil+lp@free.fr-20110627154209-azubuhbuxsz109hq
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
522
522
        if revid and committers:
523
523
            result['committers'] = 0
524
524
        if revid and revid != _mod_revision.NULL_REVISION:
 
525
            graph = self.get_graph()
525
526
            if committers:
526
527
                all_committers = set()
527
 
            revisions = self.get_ancestry(revid)
528
 
            # pop the leading None
529
 
            revisions.pop(0)
530
 
            first_revision = None
 
528
            revisions = [r for (r, p) in graph.iter_ancestry([revid])
 
529
                        if r != _mod_revision.NULL_REVISION]
 
530
            last_revision = None
531
531
            if not committers:
532
532
                # ignore the revisions in the middle - just grab first and last
533
533
                revisions = revisions[0], revisions[-1]
534
534
            for revision in self.get_revisions(revisions):
535
 
                if not first_revision:
536
 
                    first_revision = revision
 
535
                if not last_revision:
 
536
                    last_revision = revision
537
537
                if committers:
538
538
                    all_committers.add(revision.committer)
539
 
            last_revision = revision
 
539
            first_revision = revision
540
540
            if committers:
541
541
                result['committers'] = len(all_committers)
542
542
            result['firstrev'] = (first_revision.timestamp,
1002
1002
            raise AssertionError('_iter_for_revno returned too much history')
1003
1003
        return (True, partial_history[-1])
1004
1004
 
 
1005
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
1005
1006
    def iter_reverse_revision_history(self, revision_id):
1006
1007
        """Iterate backwards through revision ids in the lefthand history
1007
1008
 
1055
1056
        raise NotImplementedError(self.revision_trees)
1056
1057
 
1057
1058
    @needs_read_lock
 
1059
    @symbol_versioning.deprecated_method(
 
1060
        symbol_versioning.deprecated_in((2, 4, 0)))
1058
1061
    def get_ancestry(self, revision_id, topo_sorted=True):
1059
1062
        """Return a list of revision-ids integrated by a revision.
1060
1063
 
1064
1067
 
1065
1068
        This is topologically sorted.
1066
1069
        """
 
1070
        if 'evil' in debug.debug_flags:
 
1071
            mutter_callsite(2, "get_ancestry is linear with history.")
1067
1072
        if _mod_revision.is_null(revision_id):
1068
1073
            return [None]
1069
1074
        if not self.has_revision(revision_id):
1833
1838
        it is encountered, history extension will stop.
1834
1839
    """
1835
1840
    start_revision = partial_history_cache[-1]
1836
 
    iterator = repo.iter_reverse_revision_history(start_revision)
 
1841
    graph = repo.get_graph()
 
1842
    iterator = graph.iter_lefthand_ancestry(start_revision,
 
1843
        (_mod_revision.NULL_REVISION,))
1837
1844
    try:
1838
 
        #skip the last revision in the list
 
1845
        # skip the last revision in the list
1839
1846
        iterator.next()
1840
1847
        while True:
1841
1848
            if (stop_index is not None and