331
331
self._check_revision_parents(r, inv)
335
def get_deltas_for_revisions(self, revisions):
336
"""Produce a generator of revision deltas.
338
Note that the input is a sequence of REVISIONS, not revision_ids.
339
Trees will be held in memory until the generator exits.
340
Each delta is relative to the revision's lefthand predecessor.
342
required_trees = set()
343
for revision in revisions:
344
required_trees.add(revision.revision_id)
345
required_trees.update(revision.parent_ids[:1])
346
trees = dict((t.get_revision_id(), t) for
347
t in self.revision_trees(required_trees))
348
for revision in revisions:
349
if not revision.parent_ids:
350
old_tree = EmptyTree()
352
old_tree = trees[revision.parent_ids[0]]
353
yield delta.compare_trees(old_tree, trees[revision.revision_id])
334
356
def get_revision_delta(self, revision_id):
335
357
"""Return the delta for one revision.
337
359
The delta is relative to the left-hand predecessor of the
340
revision = self.get_revision(revision_id)
341
new_tree = self.revision_tree(revision_id)
342
if not revision.parent_ids:
343
old_tree = EmptyTree()
345
old_tree = self.revision_tree(revision.parent_ids[0])
346
return delta.compare_trees(old_tree, new_tree)
362
r = self.get_revision(revision_id)
363
return list(self.get_deltas_for_revisions([r]))[0]
348
365
def _check_revision_parents(self, revision, inventory):
349
366
"""Private to Repository and Fetch.
550
567
return RevisionTree(self, inv, revision_id)
570
def revision_trees(self, revision_ids):
571
"""Return Tree for a revision on this branch.
573
`revision_id` may not be None or 'null:'"""
574
assert None not in revision_ids
575
assert NULL_REVISION not in revision_ids
576
texts = self.get_inventory_weave().get_texts(revision_ids)
577
for text, revision_id in zip(texts, revision_ids):
578
inv = self.deserialise_inventory(revision_id, text)
579
yield RevisionTree(self, inv, revision_id)
553
582
def get_ancestry(self, revision_id):
554
583
"""Return a list of revision-ids integrated by a revision.