~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-02-23 17:00:36 UTC
  • mfrom: (4032.1.4 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090223170036-3q1v68ewdt8i0to5
(Marius Kruger) Remove all trailing whitespace and add tests to
        enforce this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
            pending changes of any sort during this commit.
238
238
        :param exclude: None or a list of relative paths to exclude from the
239
239
            commit. Pending changes to excluded files will be ignored by the
240
 
            commit. 
 
240
            commit.
241
241
        """
242
242
        mutter('preparing to commit')
243
243
 
441
441
        # If length == 1, then we only have the root entry. Which means
442
442
        # that there is no real difference (only the root could be different)
443
443
        # unless deletes occured, in which case the length is irrelevant.
444
 
        if (self.any_entries_deleted or 
 
444
        if (self.any_entries_deleted or
445
445
            (len(self.builder.new_inventory) != 1 and
446
446
             self.any_entries_changed)):
447
447
            return
476
476
        #       commits to the remote branch if they would fit.
477
477
        #       But for now, just require remote to be identical
478
478
        #       to local.
479
 
        
 
479
 
480
480
        # Make sure the local branch is identical to the master
481
481
        master_info = self.master_branch.last_revision_info()
482
482
        local_info = self.branch.last_revision_info()
539
539
    def _process_hooks(self, hook_name, old_revno, new_revno):
540
540
        if not Branch.hooks[hook_name]:
541
541
            return
542
 
        
 
542
 
543
543
        # new style commit hooks:
544
544
        if not self.bound_branch:
545
545
            hook_master = self.branch
554
554
            old_revid = self.parents[0]
555
555
        else:
556
556
            old_revid = bzrlib.revision.NULL_REVISION
557
 
        
 
557
 
558
558
        if hook_name == "pre_commit":
559
559
            future_tree = self.builder.revision_tree()
560
560
            tree_delta = future_tree.changes_from(self.basis_tree,
561
561
                                             include_root=True)
562
 
        
 
562
 
563
563
        for hook in Branch.hooks[hook_name]:
564
564
            # show the running hook in the progress bar. As hooks may
565
565
            # end up doing nothing (e.g. because they are not configured by
595
595
            # typically this will be useful enough.
596
596
            except Exception, e:
597
597
                found_exception = e
598
 
        if found_exception is not None: 
 
598
        if found_exception is not None:
599
599
            # don't do a plan raise, because the last exception may have been
600
600
            # trashed, e is our sure-to-work exception even though it loses the
601
601
            # full traceback. XXX: RBC 20060421 perhaps we could check the
602
 
            # exc_info and if its the same one do a plain raise otherwise 
 
602
            # exc_info and if its the same one do a plain raise otherwise
603
603
            # 'raise e' as we do now.
604
604
            raise e
605
605
 
621
621
        # serialiser not by commit. Then we can also add an unescaper
622
622
        # in the deserializer and start roundtripping revision messages
623
623
        # precisely. See repository_implementations/test_repository.py
624
 
        
 
624
 
625
625
        # Python strings can include characters that can't be
626
626
        # represented in well-formed XML; escape characters that
627
627
        # aren't listed in the XML specification
635
635
 
636
636
    def _gather_parents(self):
637
637
        """Record the parents of a merge for merge detection."""
638
 
        # TODO: Make sure that this list doesn't contain duplicate 
 
638
        # TODO: Make sure that this list doesn't contain duplicate
639
639
        # entries and the order is preserved when doing this.
640
640
        self.parents = self.work_tree.get_parent_ids()
641
641
        self.parent_invs = [self.basis_inv]
654
654
        #
655
655
        # This starts by creating a new empty inventory. Depending on
656
656
        # which files are selected for commit, and what is present in the
657
 
        # current tree, the new inventory is populated. inventory entries 
 
657
        # current tree, the new inventory is populated. inventory entries
658
658
        # which are candidates for modification have their revision set to
659
659
        # None; inventory entries that are carried over untouched have their
660
660
        # revision set to their prior value.
731
731
            # raise an exception as soon as we find a single unknown.
732
732
            for unknown in self.work_tree.unknowns():
733
733
                raise StrictCommitFailed()
734
 
        
 
734
 
735
735
        specific_files = self.specific_files
736
736
        exclude = self.exclude
737
737
        report_changes = self.reporter.is_verbose()
827
827
        # FIXME: be more comprehensive here:
828
828
        # this works when both trees are in --trees repository,
829
829
        # but when both are bound to a different repository,
830
 
        # it fails; a better way of approaching this is to 
 
830
        # it fails; a better way of approaching this is to
831
831
        # finally implement the explicit-caches approach design
832
832
        # a while back - RBC 20070306.
833
833
        if sub_tree.branch.repository.has_same_location(
880
880
        else:
881
881
            basis_ie = None
882
882
        change = ie.describe_change(basis_ie, ie)
883
 
        if change in (InventoryEntry.RENAMED, 
 
883
        if change in (InventoryEntry.RENAMED,
884
884
            InventoryEntry.MODIFIED_AND_RENAMED):
885
885
            old_path = self.basis_inv.id2path(ie.file_id)
886
886
            self.reporter.renamed(change, old_path, path)