~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-08 08:12:00 UTC
  • mfrom: (2858.2.5 remove-checks)
  • Revision ID: pqm@pqm.ubuntu.com-20071008081200-04a0byt5lo5tyft9
Remove old calls to safe_file_id and safe_revision_id (mbp)

Show diffs side-by-side

added added

removed removed

Lines of Context:
555
555
        :returns: format_signature, list of (version, options, length, parents),
556
556
            reader_callable.
557
557
        """
558
 
        required_versions = set([osutils.safe_revision_id(v) for v in
559
 
            required_versions])
 
558
        if not isinstance(required_versions, set):
 
559
            required_versions = set(required_versions)
560
560
        # we don't care about inclusions, the caller cares.
561
561
        # but we need to setup a list of records to visit.
562
562
        for version_id in required_versions:
611
611
 
612
612
    def get_delta(self, version_id):
613
613
        """Get a delta for constructing version from some other version."""
614
 
        version_id = osutils.safe_revision_id(version_id)
615
614
        self.check_not_reserved_id(version_id)
616
615
        parents = self.get_parents(version_id)
617
616
        if len(parents):
654
653
 
655
654
    def get_sha1s(self, version_ids):
656
655
        """See VersionedFile.get_sha1()."""
657
 
        version_ids = [osutils.safe_revision_id(v) for v in version_ids]
658
656
        record_map = self._get_record_map(version_ids)
659
657
        # record entry 2 is the 'digest'.
660
658
        return [record_map[v][2] for v in version_ids]
666
664
 
667
665
    def has_ghost(self, version_id):
668
666
        """True if there is a ghost reference in the file to version_id."""
669
 
        version_id = osutils.safe_revision_id(version_id)
670
667
        # maybe we have it
671
668
        if self.has_version(version_id):
672
669
            return False
732
729
        """See VersionedFile.has_version."""
733
730
        if 'evil' in debug.debug_flags:
734
731
            trace.mutter_callsite(2, "has_version is a LBYL scenario")
735
 
        version_id = osutils.safe_revision_id(version_id)
736
732
        return self._index.has_version(version_id)
737
733
 
738
734
    __contains__ = has_version
968
964
 
969
965
    def get_line_list(self, version_ids):
970
966
        """Return the texts of listed versions as a list of strings."""
971
 
        version_ids = [osutils.safe_revision_id(v) for v in version_ids]
972
967
        for version_id in version_ids:
973
968
            self.check_not_reserved_id(version_id)
974
969
        text_map, content_map = self._get_content_maps(version_ids)
1042
1037
        """See VersionedFile.iter_lines_added_or_present_in_versions()."""
1043
1038
        if version_ids is None:
1044
1039
            version_ids = self.versions()
1045
 
        else:
1046
 
            version_ids = [osutils.safe_revision_id(v) for v in version_ids]
1047
1040
        if pb is None:
1048
1041
            pb = progress.DummyProgress()
1049
1042
        # we don't care about inclusions, the caller cares.
1086
1079
            The order is undefined, allowing for different optimisations in
1087
1080
            the underlying implementation.
1088
1081
        """
1089
 
        version_ids = [osutils.safe_revision_id(version_id) for
1090
 
            version_id in version_ids]
1091
1082
        return self._index.iter_parents(version_ids)
1092
1083
 
1093
1084
    def num_versions(self):
1098
1089
 
1099
1090
    def annotate_iter(self, version_id):
1100
1091
        """See VersionedFile.annotate_iter."""
1101
 
        version_id = osutils.safe_revision_id(version_id)
1102
1092
        return self.factory.annotate_iter(self, version_id)
1103
1093
 
1104
1094
    def get_parents(self, version_id):
1106
1096
        # perf notes:
1107
1097
        # optimism counts!
1108
1098
        # 52554 calls in 1264 872 internal down from 3674
1109
 
        version_id = osutils.safe_revision_id(version_id)
1110
1099
        try:
1111
1100
            return self._index.get_parents(version_id)
1112
1101
        except KeyError:
1114
1103
 
1115
1104
    def get_parents_with_ghosts(self, version_id):
1116
1105
        """See VersionedFile.get_parents."""
1117
 
        version_id = osutils.safe_revision_id(version_id)
1118
1106
        try:
1119
1107
            return self._index.get_parents_with_ghosts(version_id)
1120
1108
        except KeyError:
1126
1114
            versions = [versions]
1127
1115
        if not versions:
1128
1116
            return []
1129
 
        versions = [osutils.safe_revision_id(v) for v in versions]
1130
1117
        return self._index.get_ancestry(versions, topo_sorted)
1131
1118
 
1132
1119
    def get_ancestry_with_ghosts(self, versions):
1135
1122
            versions = [versions]
1136
1123
        if not versions:
1137
1124
            return []
1138
 
        versions = [osutils.safe_revision_id(v) for v in versions]
1139
1125
        return self._index.get_ancestry_with_ghosts(versions)
1140
1126
 
1141
1127
    def plan_merge(self, ver_a, ver_b):
1142
1128
        """See VersionedFile.plan_merge."""
1143
 
        ver_a = osutils.safe_revision_id(ver_a)
1144
 
        ver_b = osutils.safe_revision_id(ver_b)
1145
1129
        ancestors_b = set(self.get_ancestry(ver_b, topo_sorted=False))
1146
 
        
1147
1130
        ancestors_a = set(self.get_ancestry(ver_a, topo_sorted=False))
1148
1131
        annotated_a = self.annotate(ver_a)
1149
1132
        annotated_b = self.annotate(ver_b)