332
332
if not (self.allow_pointless
333
333
or len(self.parents) > 1
334
or self.new_inv != self.basis_inv):
334
or self.builder.new_inventory != self.basis_inv):
335
335
raise PointlessCommit()
337
337
self._emit_progress_update()
338
338
self.inv_sha1 = self.branch.repository.add_inventory(
340
self.builder.new_inventory,
341
341
self.present_parents
343
343
self._emit_progress_update()
513
513
revision_id=self.rev_id,
514
514
properties=self.revprops)
515
515
rev.parent_ids = self.parents
516
self.branch.repository.add_revision(self.rev_id, rev, self.new_inv, self.config)
516
self.branch.repository.add_revision(self.rev_id, rev,
517
self.builder.new_inventory, self.config)
518
519
def _remove_deleted(self):
519
520
"""Remove deleted files from the working inventories.
554
555
# iter_entries does not visit the ROOT_ID node so we need to call
555
556
# self._emit_progress_update once by hand.
556
557
self._emit_progress_update()
557
for path, ie in self.new_inv.iter_entries():
558
for path, ie in self.builder.new_inventory.iter_entries():
558
559
self._emit_progress_update()
559
560
self.builder.record_entry_contents(ie, self.parent_invs,
560
561
self.rev_id, path, self.work_tree)
600
601
# this is selected, ensure its parents are too.
601
602
parent_id = new_ie.parent_id
602
603
while parent_id != ROOT_ID:
603
if not self.new_inv.has_id(parent_id):
604
if not self.builder.new_inventory.has_id(parent_id):
605
# when selectively committing a file in a new dir,
606
# suck up the dir too.
604
607
ie = self._select_entry(self.work_inv[parent_id])
605
608
mutter('%s selected for commit because of %s',
606
self.new_inv.id2path(parent_id), path)
608
ie = self.new_inv[parent_id]
609
if ie.revision is not None:
611
mutter('%s selected for commit because of %s',
612
self.new_inv.id2path(parent_id), path)
613
parent_id = ie.parent_id
609
self.builder.new_inventory.id2path(parent_id),
611
parent_id = ie.parent_id
613
ie = self.builder.new_inventory[parent_id]
614
if ie.revision is not None:
616
mutter('%s selected for commit because of %s',
617
self.builder.new_inventory.id2path(parent_id),
619
parent_id = ie.parent_id
621
# our parent is already selected.
614
623
mutter('%s selected for commit', path)
615
624
self._select_entry(new_ie)
623
632
"""Make new_ie be considered for committing."""
624
633
ie = new_ie.copy()
625
634
ie.revision = None
635
self.builder.new_inventory.add(ie)
629
638
def _carry_entry(self, file_id):
630
639
"""Carry the file unchanged from the basis revision."""
631
640
if self.basis_inv.has_id(file_id):
632
self.new_inv.add(self.basis_inv[file_id].copy())
641
self.builder.new_inventory.add(self.basis_inv[file_id].copy())
634
643
# this entry is new and not being committed
635
644
self.pb_total -= 1
637
646
def _report_deletes(self):
638
647
for path, ie in self.basis_inv.iter_entries():
639
if ie.file_id not in self.new_inv:
648
if ie.file_id not in self.builder.new_inventory:
640
649
self.reporter.deleted(path)
642
651
def _gen_revision_id(config, when):