~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

(jelmer) Deprecate Branch.revision_history(). (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1007
1007
        """
1008
1008
        raise NotImplementedError(self._gen_revision_history)
1009
1009
 
 
1010
    @deprecated_method(deprecated_in((2, 5, 0)))
1010
1011
    @needs_read_lock
1011
1012
    def revision_history(self):
1012
1013
        """Return sequence of revision ids on this branch.
1014
1015
        This method will cache the revision history for as long as it is safe to
1015
1016
        do so.
1016
1017
        """
 
1018
        return self._revision_history()
 
1019
 
 
1020
    def _revision_history(self):
1017
1021
        if 'evil' in debug.debug_flags:
1018
1022
            mutter_callsite(3, "revision_history scales with history.")
1019
1023
        if self._revision_history_cache is not None:
1089
1093
        """Given a revision id, return its revno"""
1090
1094
        if _mod_revision.is_null(revision_id):
1091
1095
            return 0
1092
 
        history = self.revision_history()
 
1096
        history = self._revision_history()
1093
1097
        try:
1094
1098
            return history.index(revision_id) + 1
1095
1099
        except ValueError:
1392
1396
        # TODO: We should probably also check that self.revision_history
1393
1397
        # matches the repository for older branch formats.
1394
1398
        # If looking for the code that cross-checks repository parents against
1395
 
        # the iter_reverse_revision_history output, that is now a repository
 
1399
        # the Graph.iter_lefthand_ancestry output, that is now a repository
1396
1400
        # specific check.
1397
1401
        return result
1398
1402
 
2714
2718
        self._set_revision_history(history)
2715
2719
 
2716
2720
    def _read_last_revision_info(self):
2717
 
        rh = self.revision_history()
 
2721
        rh = self._revision_history()
2718
2722
        revno = len(rh)
2719
2723
        if revno:
2720
2724
            return (revno, rh[-1])
2774
2778
        if revision_id == _mod_revision.NULL_REVISION:
2775
2779
            new_history = []
2776
2780
        else:
2777
 
            new_history = self.revision_history()
 
2781
            new_history = self._revision_history()
2778
2782
        if revision_id is not None and new_history != []:
2779
2783
            try:
2780
2784
                new_history = new_history[:new_history.index(revision_id) + 1]