~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Jelmer Vernooij
  • Date: 2006-06-07 12:19:04 UTC
  • mto: This revision was merged to the branch mainline in revision 1753.
  • Revision ID: jelmer@samba.org-20060607121904-25ea202d89f1d17e
Move inventory to commit builder.
Add is_inside_or_parent_of_any()

Show diffs side-by-side

added added

removed removed

Lines of Context:
331
331
 
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()
336
336
 
337
337
            self._emit_progress_update()
338
338
            self.inv_sha1 = self.branch.repository.add_inventory(
339
339
                self.rev_id,
340
 
                self.new_inv,
 
340
                self.builder.new_inventory,
341
341
                self.present_parents
342
342
                )
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)
517
518
 
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)
607
 
 
608
 
                        ie = self.new_inv[parent_id]
609
 
                        if ie.revision is not None:
610
 
                            ie.revision = 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), 
 
610
                                   path)
 
611
                            parent_id = ie.parent_id
 
612
                        else:
 
613
                            ie = self.builder.new_inventory[parent_id]
 
614
                            if ie.revision is not None:
 
615
                                ie.revision = None
 
616
                                mutter('%s selected for commit because of %s',
 
617
                                       self.builder.new_inventory.id2path(parent_id), 
 
618
                                       path)
 
619
                                parent_id = ie.parent_id
 
620
                            else:
 
621
                                # our parent is already selected.
 
622
                                parent_id = ROOT_ID
614
623
            mutter('%s selected for commit', path)
615
624
            self._select_entry(new_ie)
616
625
 
623
632
        """Make new_ie be considered for committing."""
624
633
        ie = new_ie.copy()
625
634
        ie.revision = None
626
 
        self.new_inv.add(ie)
 
635
        self.builder.new_inventory.add(ie)
627
636
        return ie
628
637
 
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())
633
642
        else:
634
643
            # this entry is new and not being committed
635
644
            self.pb_total -= 1
636
645
 
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)
641
650
 
642
651
def _gen_revision_id(config, when):