981
981
raise AssertionError('_iter_for_revno returned too much history')
982
982
return (True, partial_history[-1])
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
988
:param revision_id: The revision id to start with. All its lefthand
989
ancestors will be traversed.
991
graph = self.get_graph()
992
stop_revisions = (None, _mod_revision.NULL_REVISION)
993
return graph.iter_lefthand_ancestry(revision_id, stop_revisions)
995
984
def is_shared(self):
996
985
"""Return True if this repository is flagged as a shared repository."""
997
986
raise NotImplementedError(self.is_shared)
1035
1024
raise NotImplementedError(self.revision_trees)
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.
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.
1047
This is topologically sorted.
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):
1053
if not self.has_revision(revision_id):
1054
raise errors.NoSuchRevision(self, revision_id)
1055
graph = self.get_graph()
1057
search = graph._make_breadth_first_searcher([revision_id])
1060
found, ghosts = search.next_with_ghosts()
1061
except StopIteration:
1064
if _mod_revision.NULL_REVISION in keys:
1065
keys.remove(_mod_revision.NULL_REVISION)
1067
parent_map = graph.get_parent_map(keys)
1068
keys = tsort.topo_sort(parent_map)
1069
return [None] + list(keys)
1071
1026
def pack(self, hint=None, clean_obsolete_packs=False):
1072
1027
"""Compress the data within the repository.
1174
1129
@needs_read_lock
1175
1130
def verify_revision_signature(self, revision_id, gpg_strategy):
1176
1131
"""Verify the signature on a revision.
1178
1133
:param revision_id: the revision to verify
1179
1134
:gpg_strategy: the GPGStrategy object to used
1181
1136
:return: gpg.SIGNATURE_VALID or a failed SIGNATURE_ value
1183
1138
if not self.has_signature_for_revision_id(revision_id):
1190
1145
return gpg_strategy.verify(signature, plaintext)
1148
def verify_revision_signatures(self, revision_ids, gpg_strategy):
1149
"""Verify revision signatures for a number of revisions.
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
1155
for revid in revision_ids:
1156
(result, key) = self.verify_revision_signature(revid, gpg_strategy)
1157
yield revid, result, key
1192
1159
def has_signature_for_revision_id(self, revision_id):
1193
1160
"""Query for a revision signature for revision_id in the repository."""
1194
1161
raise NotImplementedError(self.has_signature_for_revision_id)
1420
1387
def __ne__(self, other):
1421
1388
return not self == other
1424
@symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
1425
def register_format(klass, format):
1426
format_registry.register(format)
1429
@symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
1430
def unregister_format(klass, format):
1431
format_registry.remove(format)
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()
1439
1390
def get_format_description(self):
1440
1391
"""Return the short description for this format."""
1441
1392
raise NotImplementedError(self.get_format_description)