592
592
mutter("Selecting files for commit with filter %s", specific_files)
594
594
# Check and warn about old CommitBuilders
595
old_commit_builder = not self.builder.record_root_entry
596
if old_commit_builder:
595
if not self.builder.record_root_entry:
597
596
symbol_versioning.warn('CommitBuilders should support recording'
598
597
' the root entry as of bzr 0.10.', DeprecationWarning,
600
599
self.builder.new_inventory.add(self.basis_inv.root.copy())
602
601
# Build the new inventory
603
self._populate_from_inventory(specific_files, old_commit_builder)
602
self._populate_from_inventory(specific_files)
605
# If specific files/directories were nominated, it is possible
606
# that some data from outside those needs to be preserved from
607
# the basis tree. For example, if a file x is moved from out of
608
# directory foo into directory bar and the user requests
609
# ``commit foo``, then information about bar/x must also be
612
# This implies that bar knows what its children are, which isn't
613
# really accurate. Strictly speaking, bar only needs to be committed
614
# if it wasn't a directory in the basis tree - the current
615
# implementation is overkill.
604
# If specific files are selected, then all un-selected files must be
605
# recorded in their previous state. For more details, see
606
# https://lists.ubuntu.com/archives/bazaar/2007q3/028476.html.
616
607
if specific_files:
617
608
for path, new_ie in self.basis_inv.iter_entries():
618
609
if new_ie.file_id in self.builder.new_inventory:
631
622
if ie.file_id not in self.builder.new_inventory:
632
623
self.reporter.deleted(path)
634
def _populate_from_inventory(self, specific_files, skip_first_entry):
625
def _populate_from_inventory(self, specific_files):
635
626
"""Populate the CommitBuilder by walking the working tree inventory."""
637
628
# raise an exception as soon as we find a single unknown.
643
634
work_inv = self.work_tree.inventory
644
635
assert work_inv.root is not None
645
636
entries = work_inv.iter_entries()
637
if not self.builder.record_root_entry:
648
639
for path, existing_ie in entries:
649
640
file_id = existing_ie.file_id