327
327
raise AssertionError("recording deletes not activated.")
328
328
delta = (path, None, file_id, None)
329
329
self._basis_delta.append(delta)
330
self._any_changes = True
332
333
def will_record_deletes(self):
561
562
has been generated against. Currently assumed to be the same
562
563
as self.parents[0] - if it is not, errors may occur.
563
564
:param iter_changes: An iter_changes iterator with the changes to apply
564
to basis_revision_id.
565
to basis_revision_id. The iterator must not include any items with
566
a current kind of None - missing items must be either filtered out
567
or errored-on beefore record_iter_changes sees the item.
565
568
:param _entry_factory: Private method to bind entry_factory locally for
567
570
:return: A generator of (file_id, relpath, fs_hash) tuples for use with
578
581
# {file_id -> revision_id -> inventory entry, for entries in parent
579
582
# trees that are not parents[0]
580
583
parent_entries = {}
581
revtrees = list(self.repository.revision_trees(self.parents))
586
revtrees = list(self.repository.revision_trees(self.parents))
587
except errors.NoSuchRevision:
588
# one or more ghosts, slow path.
590
for revision_id in self.parents:
592
revtrees.append(self.repository.revision_tree(revision_id))
593
except errors.NoSuchRevision:
595
basis_revision_id = _mod_revision.NULL_REVISION
597
revtrees.append(self.repository.revision_tree(
598
_mod_revision.NULL_REVISION))
582
599
# The basis inventory from a repository
584
601
basis_inv = revtrees[0].inventory
586
603
basis_inv = self.repository.revision_tree(
587
604
_mod_revision.NULL_REVISION).inventory
588
605
if len(self.parents) > 0:
589
if basis_revision_id != self.parents[0]:
606
if basis_revision_id != self.parents[0] and not ghost_basis:
591
608
"arbitrary basis parents not yet supported with merges")
592
609
for revtree in revtrees[1:]:
632
649
# inv delta change: (file_id, (path_in_source, path_in_target),
633
650
# changed_content, versioned, parent, name, kind,
635
basis_entry = basis_inv[file_id]
637
(basis_inv.id2path(file_id), tree.id2path(file_id)),
639
(basis_entry.parent_id, basis_entry.parent_id),
640
(basis_entry.name, basis_entry.name),
641
(basis_entry.kind, basis_entry.kind),
642
(basis_entry.executable, basis_entry.executable))
643
changes[file_id] = (change, merged_ids[file_id])
653
basis_entry = basis_inv[file_id]
654
except errors.NoSuchId:
655
# a change from basis->some_parents but file_id isn't in basis
656
# so was new in the merge, which means it must have changed
657
# from basis -> current, and as it hasn't the add was reverted
658
# by the user. So we discard this change.
662
(basis_inv.id2path(file_id), tree.id2path(file_id)),
664
(basis_entry.parent_id, basis_entry.parent_id),
665
(basis_entry.name, basis_entry.name),
666
(basis_entry.kind, basis_entry.kind),
667
(basis_entry.executable, basis_entry.executable))
668
changes[file_id] = (change, merged_ids[file_id])
644
669
# changes contains tuples with the change and a set of inventory
645
670
# candidates for the file.