/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: Martin Pool
  • Date: 2009-03-13 07:54:48 UTC
  • mfrom: (4144 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4189.
  • Revision ID: mbp@sourcefrog.net-20090313075448-jlz1t7baz7gzipqn
merge trunk

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
 
395
395
            # Upload revision data to the master.
396
396
            # this will propagate merged revisions too if needed.
397
397
            if self.bound_branch:
398
 
                if not self.master_branch.repository.has_same_location(
399
 
                        self.branch.repository):
400
 
                    self._set_progress_stage("Uploading data to master branch")
401
 
                    self.master_branch.repository.fetch(self.branch.repository,
402
 
                        revision_id=self.rev_id)
403
 
                # now the master has the revision data
 
398
                self._set_progress_stage("Uploading data to master branch")
404
399
                # 'commit' to the master first so a timeout here causes the
405
400
                # local branch to be out of date
406
 
                self.master_branch.set_last_revision_info(new_revno,
407
 
                                                          self.rev_id)
 
401
                self.master_branch.import_last_revision_info(
 
402
                    self.branch.repository, new_revno, self.rev_id)
408
403
 
409
404
            # and now do the commit locally.
410
405
            self.branch.set_last_revision_info(new_revno, self.rev_id)
441
436
        # If length == 1, then we only have the root entry. Which means
442
437
        # that there is no real difference (only the root could be different)
443
438
        # unless deletes occured, in which case the length is irrelevant.
444
 
        if (self.any_entries_deleted or 
 
439
        if (self.any_entries_deleted or
445
440
            (len(self.builder.new_inventory) != 1 and
446
441
             self.any_entries_changed)):
447
442
            return
476
471
        #       commits to the remote branch if they would fit.
477
472
        #       But for now, just require remote to be identical
478
473
        #       to local.
479
 
        
 
474
 
480
475
        # Make sure the local branch is identical to the master
481
476
        master_info = self.master_branch.last_revision_info()
482
477
        local_info = self.branch.last_revision_info()
539
534
    def _process_hooks(self, hook_name, old_revno, new_revno):
540
535
        if not Branch.hooks[hook_name]:
541
536
            return
542
 
        
 
537
 
543
538
        # new style commit hooks:
544
539
        if not self.bound_branch:
545
540
            hook_master = self.branch
554
549
            old_revid = self.parents[0]
555
550
        else:
556
551
            old_revid = bzrlib.revision.NULL_REVISION
557
 
        
 
552
 
558
553
        if hook_name == "pre_commit":
559
554
            future_tree = self.builder.revision_tree()
560
555
            tree_delta = future_tree.changes_from(self.basis_tree,
561
556
                                             include_root=True)
562
 
        
 
557
 
563
558
        for hook in Branch.hooks[hook_name]:
564
559
            # show the running hook in the progress bar. As hooks may
565
560
            # end up doing nothing (e.g. because they are not configured by
595
590
            # typically this will be useful enough.
596
591
            except Exception, e:
597
592
                found_exception = e
598
 
        if found_exception is not None: 
 
593
        if found_exception is not None:
599
594
            # don't do a plan raise, because the last exception may have been
600
595
            # trashed, e is our sure-to-work exception even though it loses the
601
596
            # full traceback. XXX: RBC 20060421 perhaps we could check the
602
 
            # exc_info and if its the same one do a plain raise otherwise 
 
597
            # exc_info and if its the same one do a plain raise otherwise
603
598
            # 'raise e' as we do now.
604
599
            raise e
605
600
 
621
616
        # serialiser not by commit. Then we can also add an unescaper
622
617
        # in the deserializer and start roundtripping revision messages
623
618
        # precisely. See repository_implementations/test_repository.py
624
 
        
 
619
 
625
620
        # Python strings can include characters that can't be
626
621
        # represented in well-formed XML; escape characters that
627
622
        # aren't listed in the XML specification
635
630
 
636
631
    def _gather_parents(self):
637
632
        """Record the parents of a merge for merge detection."""
638
 
        # TODO: Make sure that this list doesn't contain duplicate 
 
633
        # TODO: Make sure that this list doesn't contain duplicate
639
634
        # entries and the order is preserved when doing this.
640
635
        self.parents = self.work_tree.get_parent_ids()
641
636
        self.parent_invs = [self.basis_inv]
654
649
        #
655
650
        # This starts by creating a new empty inventory. Depending on
656
651
        # which files are selected for commit, and what is present in the
657
 
        # current tree, the new inventory is populated. inventory entries 
 
652
        # current tree, the new inventory is populated. inventory entries
658
653
        # which are candidates for modification have their revision set to
659
654
        # None; inventory entries that are carried over untouched have their
660
655
        # revision set to their prior value.
731
726
            # raise an exception as soon as we find a single unknown.
732
727
            for unknown in self.work_tree.unknowns():
733
728
                raise StrictCommitFailed()
734
 
        
 
729
 
735
730
        specific_files = self.specific_files
736
731
        exclude = self.exclude
737
732
        report_changes = self.reporter.is_verbose()
827
822
        # FIXME: be more comprehensive here:
828
823
        # this works when both trees are in --trees repository,
829
824
        # but when both are bound to a different repository,
830
 
        # it fails; a better way of approaching this is to 
 
825
        # it fails; a better way of approaching this is to
831
826
        # finally implement the explicit-caches approach design
832
827
        # a while back - RBC 20070306.
833
828
        if sub_tree.branch.repository.has_same_location(
880
875
        else:
881
876
            basis_ie = None
882
877
        change = ie.describe_change(basis_ie, ie)
883
 
        if change in (InventoryEntry.RENAMED, 
 
878
        if change in (InventoryEntry.RENAMED,
884
879
            InventoryEntry.MODIFIED_AND_RENAMED):
885
880
            old_path = self.basis_inv.id2path(ie.file_id)
886
881
            self.reporter.renamed(change, old_path, path)