/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Ian Clatworthy
  • Date: 2007-07-18 05:51:29 UTC
  • mto: (2647.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 2648.
  • Revision ID: ian.clatworthy@internode.on.net-20070718055129-u6tsvsqrd4pcuikw
Incorporate feedback from abentley

Show diffs side-by-side

added added

removed removed

Lines of Context:
592
592
        mutter("Selecting files for commit with filter %s", specific_files)
593
593
 
594
594
        # Check and warn about old CommitBuilders
595
 
        root_added_already = False
596
 
        if not self.builder.record_root_entry:
 
595
        old_commit_builder = not self.builder.record_root_entry
 
596
        if old_commit_builder:
597
597
            symbol_versioning.warn('CommitBuilders should support recording'
598
598
                ' the root entry as of bzr 0.10.', DeprecationWarning, 
599
599
                stacklevel=1)
600
600
            self.builder.new_inventory.add(self.basis_inv.root.copy())
601
 
            root_added_already = True
602
601
 
603
602
        # Build the new inventory
604
 
        self._populate_from_inventory(specific_files, root_added_already)
 
603
        self._populate_from_inventory(specific_files, old_commit_builder)
605
604
 
606
605
        # If specific files/directories were nominated, it is possible
607
606
        # that some data from outside those needs to be preserved from
609
608
        # directory foo into directory bar and the user requests
610
609
        # ``commit foo``, then information about bar/x must also be
611
610
        # recorded.
 
611
        # ABENTLEY says:
 
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.
612
616
        if specific_files:
613
617
            for path, new_ie in self.basis_inv.iter_entries():
614
618
                if new_ie.file_id in self.builder.new_inventory:
627
631
            if ie.file_id not in self.builder.new_inventory:
628
632
                self.reporter.deleted(path)
629
633
 
630
 
    def _populate_from_inventory(self, specific_files, root_added_already):
 
634
    def _populate_from_inventory(self, specific_files, skip_first_entry):
631
635
        """Populate the CommitBuilder by walking the working tree inventory."""
632
636
        if self.strict:
633
637
            # raise an exception as soon as we find a single unknown.
639
643
        work_inv = self.work_tree.inventory
640
644
        assert work_inv.root is not None
641
645
        entries = work_inv.iter_entries()
642
 
        if root_added_already:
 
646
        if skip_first_entry:
643
647
            entries.next()
644
 
        for path, new_ie in entries:
645
 
            file_id = new_ie.file_id
646
 
            name = new_ie.name
647
 
            parent_id = new_ie.parent_id
648
 
            kind = new_ie.kind
 
648
        for path, existing_ie in entries:
 
649
            file_id = existing_ie.file_id
 
650
            name = existing_ie.name
 
651
            parent_id = existing_ie.parent_id
 
652
            kind = existing_ie.kind
649
653
            if kind == 'directory':
650
654
                self._next_progress_entry()
651
655
 
674
678
            # Note: I don't particularly want to have the existing_ie
675
679
            # parameter but the test suite currently (28-Jun-07) breaks
676
680
            # without it thanks to a unicode normalisation issue. :-(
677
 
            definitely_changed = kind != new_ie.kind 
 
681
            definitely_changed = kind != existing_ie.kind 
678
682
            self._record_entry(path, file_id, specific_files, kind, name,
679
 
                parent_id, definitely_changed, new_ie)
 
683
                parent_id, definitely_changed, existing_ie)
680
684
 
681
685
        # Unversion IDs that were found to be deleted
682
686
        self.work_tree.unversion(deleted_ids)