/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/knit.py

  • Committer: Martin Pool
  • Date: 2007-09-25 08:14:12 UTC
  • mto: This revision was merged to the branch mainline in revision 2895.
  • Revision ID: mbp@sourcefrog.net-20070925081412-ta60zj5qxfuokev3
Remove most calls to safe_file_id and safe_revision_id.

The deprecation period for passing unicode objects as revision ids is now over.

Show diffs side-by-side

added added

removed removed

Lines of Context:
548
548
        :returns: format_signature, list of (version, options, length, parents),
549
549
            reader_callable.
550
550
        """
551
 
        required_versions = set([osutils.safe_revision_id(v) for v in
552
 
            required_versions])
 
551
        if not isinstance(required_versions, set):
 
552
            required_versions = set(required_versions)
553
553
        # we don't care about inclusions, the caller cares.
554
554
        # but we need to setup a list of records to visit.
555
555
        for version_id in required_versions:
604
604
 
605
605
    def get_delta(self, version_id):
606
606
        """Get a delta for constructing version from some other version."""
607
 
        version_id = osutils.safe_revision_id(version_id)
608
607
        self.check_not_reserved_id(version_id)
609
608
        parents = self.get_parents(version_id)
610
609
        if len(parents):
647
646
 
648
647
    def get_sha1s(self, version_ids):
649
648
        """See VersionedFile.get_sha1()."""
650
 
        version_ids = [osutils.safe_revision_id(v) for v in version_ids]
651
649
        record_map = self._get_record_map(version_ids)
652
650
        # record entry 2 is the 'digest'.
653
651
        return [record_map[v][2] for v in version_ids]
659
657
 
660
658
    def has_ghost(self, version_id):
661
659
        """True if there is a ghost reference in the file to version_id."""
662
 
        version_id = osutils.safe_revision_id(version_id)
663
660
        # maybe we have it
664
661
        if self.has_version(version_id):
665
662
            return False
725
722
        """See VersionedFile.has_version."""
726
723
        if 'evil' in debug.debug_flags:
727
724
            trace.mutter_callsite(2, "has_version is a LBYL scenario")
728
 
        version_id = osutils.safe_revision_id(version_id)
729
725
        return self._index.has_version(version_id)
730
726
 
731
727
    __contains__ = has_version
961
957
 
962
958
    def get_line_list(self, version_ids):
963
959
        """Return the texts of listed versions as a list of strings."""
964
 
        version_ids = [osutils.safe_revision_id(v) for v in version_ids]
965
960
        for version_id in version_ids:
966
961
            self.check_not_reserved_id(version_id)
967
962
        text_map, content_map = self._get_content_maps(version_ids)
1038
1033
        """See VersionedFile.iter_lines_added_or_present_in_versions()."""
1039
1034
        if version_ids is None:
1040
1035
            version_ids = self.versions()
1041
 
        else:
1042
 
            version_ids = [osutils.safe_revision_id(v) for v in version_ids]
1043
1036
        if pb is None:
1044
1037
            pb = progress.DummyProgress()
1045
1038
        # we don't care about inclusions, the caller cares.
1082
1075
            The order is undefined, allowing for different optimisations in
1083
1076
            the underlying implementation.
1084
1077
        """
1085
 
        version_ids = [osutils.safe_revision_id(version_id) for
1086
 
            version_id in version_ids]
1087
1078
        return self._index.iter_parents(version_ids)
1088
1079
 
1089
1080
    def num_versions(self):
1094
1085
 
1095
1086
    def annotate_iter(self, version_id):
1096
1087
        """See VersionedFile.annotate_iter."""
1097
 
        version_id = osutils.safe_revision_id(version_id)
1098
1088
        return self.factory.annotate_iter(self, version_id)
1099
1089
 
1100
1090
    def get_parents(self, version_id):
1102
1092
        # perf notes:
1103
1093
        # optimism counts!
1104
1094
        # 52554 calls in 1264 872 internal down from 3674
1105
 
        version_id = osutils.safe_revision_id(version_id)
1106
1095
        try:
1107
1096
            return self._index.get_parents(version_id)
1108
1097
        except KeyError:
1110
1099
 
1111
1100
    def get_parents_with_ghosts(self, version_id):
1112
1101
        """See VersionedFile.get_parents."""
1113
 
        version_id = osutils.safe_revision_id(version_id)
1114
1102
        try:
1115
1103
            return self._index.get_parents_with_ghosts(version_id)
1116
1104
        except KeyError:
1122
1110
            versions = [versions]
1123
1111
        if not versions:
1124
1112
            return []
1125
 
        versions = [osutils.safe_revision_id(v) for v in versions]
1126
1113
        return self._index.get_ancestry(versions, topo_sorted)
1127
1114
 
1128
1115
    def get_ancestry_with_ghosts(self, versions):
1131
1118
            versions = [versions]
1132
1119
        if not versions:
1133
1120
            return []
1134
 
        versions = [osutils.safe_revision_id(v) for v in versions]
1135
1121
        return self._index.get_ancestry_with_ghosts(versions)
1136
1122
 
1137
1123
    def plan_merge(self, ver_a, ver_b):
1138
1124
        """See VersionedFile.plan_merge."""
1139
 
        ver_a = osutils.safe_revision_id(ver_a)
1140
 
        ver_b = osutils.safe_revision_id(ver_b)
1141
1125
        ancestors_b = set(self.get_ancestry(ver_b, topo_sorted=False))
1142
 
        
1143
1126
        ancestors_a = set(self.get_ancestry(ver_a, topo_sorted=False))
1144
1127
        annotated_a = self.annotate(ver_a)
1145
1128
        annotated_b = self.annotate(ver_b)