~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Ross Lagerwall
  • Date: 2012-08-07 06:32:51 UTC
  • mto: (6437.63.5 2.5)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: rosslagerwall@gmail.com-20120807063251-x9p03ghg2ws8oqjc
Add bzrlib/locale to .bzrignore

bzrlib/locale is generated with ./setup.py build_mo which is in turn called
by ./setup.py build

Show diffs side-by-side

added added

removed removed

Lines of Context:
981
981
            raise AssertionError('_iter_for_revno returned too much history')
982
982
        return (True, partial_history[-1])
983
983
 
 
984
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
 
985
    def iter_reverse_revision_history(self, revision_id):
 
986
        """Iterate backwards through revision ids in the lefthand history
 
987
 
 
988
        :param revision_id: The revision id to start with.  All its lefthand
 
989
            ancestors will be traversed.
 
990
        """
 
991
        graph = self.get_graph()
 
992
        stop_revisions = (None, _mod_revision.NULL_REVISION)
 
993
        return graph.iter_lefthand_ancestry(revision_id, stop_revisions)
 
994
 
984
995
    def is_shared(self):
985
996
        """Return True if this repository is flagged as a shared repository."""
986
997
        raise NotImplementedError(self.is_shared)
1023
1034
        """
1024
1035
        raise NotImplementedError(self.revision_trees)
1025
1036
 
 
1037
    @needs_read_lock
 
1038
    @symbol_versioning.deprecated_method(
 
1039
        symbol_versioning.deprecated_in((2, 4, 0)))
 
1040
    def get_ancestry(self, revision_id, topo_sorted=True):
 
1041
        """Return a list of revision-ids integrated by a revision.
 
1042
 
 
1043
        The first element of the list is always None, indicating the origin
 
1044
        revision.  This might change when we have history horizons, or
 
1045
        perhaps we should have a new API.
 
1046
 
 
1047
        This is topologically sorted.
 
1048
        """
 
1049
        if 'evil' in debug.debug_flags:
 
1050
            mutter_callsite(2, "get_ancestry is linear with history.")
 
1051
        if _mod_revision.is_null(revision_id):
 
1052
            return [None]
 
1053
        if not self.has_revision(revision_id):
 
1054
            raise errors.NoSuchRevision(self, revision_id)
 
1055
        graph = self.get_graph()
 
1056
        keys = set()
 
1057
        search = graph._make_breadth_first_searcher([revision_id])
 
1058
        while True:
 
1059
            try:
 
1060
                found, ghosts = search.next_with_ghosts()
 
1061
            except StopIteration:
 
1062
                break
 
1063
            keys.update(found)
 
1064
        if _mod_revision.NULL_REVISION in keys:
 
1065
            keys.remove(_mod_revision.NULL_REVISION)
 
1066
        if topo_sorted:
 
1067
            parent_map = graph.get_parent_map(keys)
 
1068
            keys = tsort.topo_sort(parent_map)
 
1069
        return [None] + list(keys)
 
1070
 
1026
1071
    def pack(self, hint=None, clean_obsolete_packs=False):
1027
1072
        """Compress the data within the repository.
1028
1073
 
1129
1174
    @needs_read_lock
1130
1175
    def verify_revision_signature(self, revision_id, gpg_strategy):
1131
1176
        """Verify the signature on a revision.
1132
 
 
 
1177
        
1133
1178
        :param revision_id: the revision to verify
1134
1179
        :gpg_strategy: the GPGStrategy object to used
1135
 
 
 
1180
        
1136
1181
        :return: gpg.SIGNATURE_VALID or a failed SIGNATURE_ value
1137
1182
        """
1138
1183
        if not self.has_signature_for_revision_id(revision_id):
1144
1189
 
1145
1190
        return gpg_strategy.verify(signature, plaintext)
1146
1191
 
1147
 
    @needs_read_lock
1148
 
    def verify_revision_signatures(self, revision_ids, gpg_strategy):
1149
 
        """Verify revision signatures for a number of revisions.
1150
 
 
1151
 
        :param revision_id: the revision to verify
1152
 
        :gpg_strategy: the GPGStrategy object to used
1153
 
        :return: Iterator over tuples with revision id, result and keys
1154
 
        """
1155
 
        for revid in revision_ids:
1156
 
            (result, key) = self.verify_revision_signature(revid, gpg_strategy)
1157
 
            yield revid, result, key
1158
 
 
1159
1192
    def has_signature_for_revision_id(self, revision_id):
1160
1193
        """Query for a revision signature for revision_id in the repository."""
1161
1194
        raise NotImplementedError(self.has_signature_for_revision_id)
1191
1224
            return
1192
1225
        try:
1193
1226
            if branch is None:
1194
 
                conf = config.GlobalStack()
 
1227
                conf = config.GlobalConfig()
1195
1228
            else:
1196
 
                conf = branch.get_config_stack()
1197
 
            if 'format_deprecation' in conf.get('suppress_warnings'):
 
1229
                conf = branch.get_config()
 
1230
            if conf.suppress_warning('format_deprecation'):
1198
1231
                return
1199
1232
            warning("Format %s for %s is deprecated -"
1200
1233
                    " please use 'bzr upgrade' to get better performance"
1387
1420
    def __ne__(self, other):
1388
1421
        return not self == other
1389
1422
 
 
1423
    @classmethod
 
1424
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
 
1425
    def register_format(klass, format):
 
1426
        format_registry.register(format)
 
1427
 
 
1428
    @classmethod
 
1429
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
 
1430
    def unregister_format(klass, format):
 
1431
        format_registry.remove(format)
 
1432
 
 
1433
    @classmethod
 
1434
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
 
1435
    def get_default_format(klass):
 
1436
        """Return the current default format."""
 
1437
        return format_registry.get_default()
 
1438
 
1390
1439
    def get_format_description(self):
1391
1440
        """Return the short description for this format."""
1392
1441
        raise NotImplementedError(self.get_format_description)