885
885
raise NotImplementedError(self.iter_revisions)
887
def get_deltas_for_revisions(self, revisions, specific_fileids=None):
888
"""Produce a generator of revision deltas.
890
Note that the input is a sequence of REVISIONS, not revision_ids.
891
Trees will be held in memory until the generator exits.
892
Each delta is relative to the revision's lefthand predecessor.
894
:param specific_fileids: if not None, the result is filtered
895
so that only those file-ids, their parents and their
896
children are included.
898
raise NotImplementedError(self.get_deltas_for_revisions)
900
887
def get_revision_delta(self, revision_id):
901
888
"""Return the delta for one revision.
906
893
with self.lock_read():
907
894
r = self.get_revision(revision_id)
908
return list(self.get_deltas_for_revisions([r]))[0]
895
return list(self.get_revision_deltas([r]))[0]
897
def get_revision_deltas(self, revisions, specific_files=None):
898
"""Produce a generator of revision deltas.
900
Note that the input is a sequence of REVISIONS, not revision ids.
901
Trees will be held in memory until the generator exits.
902
Each delta is relative to the revision's lefthand predecessor.
904
specific_files should exist in the first revision.
906
:param specific_files: if not None, the result is filtered
907
so that only those files, their parents and their
908
children are included.
910
from .tree import InterTree
911
# Get the revision-ids of interest
912
required_trees = set()
913
for revision in revisions:
914
required_trees.add(revision.revision_id)
915
required_trees.update(revision.parent_ids[:1])
918
t.get_revision_id(): t
919
for t in self.revision_trees(required_trees)}
921
# Calculate the deltas
922
for revision in revisions:
923
if not revision.parent_ids:
924
old_tree = self.revision_tree(_mod_revision.NULL_REVISION)
926
old_tree = trees[revision.parent_ids[0]]
927
intertree = InterTree.get(old_tree, trees[revision.revision_id])
928
yield intertree.compare(specific_files=specific_files)
929
if specific_files is not None:
931
p for p in intertree.find_source_paths(
932
specific_files).values()
910
935
def store_revision_signature(self, gpg_strategy, plaintext, revision_id):
911
936
raise NotImplementedError(self.store_revision_signature)
1505
1530
self.target.set_make_working_trees(
1506
1531
self.source.make_working_trees())
1507
except NotImplementedError:
1532
except (NotImplementedError, errors.RepositoryUpgradeRequired):
1509
1534
self.target.fetch(self.source, revision_id=revision_id)