~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2009-10-06 14:40:37 UTC
  • mto: (4728.1.2 integration)
  • mto: This revision was merged to the branch mainline in revision 4731.
  • Revision ID: v.ladeuil+lp@free.fr-20091006144037-o76rgosv9hj3td0y
Simplify mutable_tree.has_changes() and update call sites.

* bzrlib/workingtree.py:
(WorkingTree.merge_from_branch): Add a force parameter. Replace
the check_basis() call by the corresponding code, taken the new
'force' parameter into account.

* bzrlib/tests/test_status.py:
(TestStatus.make_multiple_pending_tree): Add force=True on
supplementary merges.

* bzrlib/tests/test_reconfigure.py:
(TestReconfigure): Add a test for pending merges.

* bzrlib/tests/test_msgeditor.py:
(MsgEditorTest.make_multiple_pending_tree): Add force=True on
supplementary merges.

* bzrlib/tests/blackbox/test_uncommit.py:
(TestUncommit.test_uncommit_octopus_merge): Add force=True on
supplementary merges.

* bzrlib/send.py:
(send): Use the simplified has_changes(). Fix typo in comment too.

* bzrlib/reconfigure.py:
(Reconfigure._check): Use the simplified has_changes().

* bzrlib/mutabletree.py:
(MutableTree.has_changes): Make the tree parameter optional but
retain it for tests. Add a pending merges check.

* bzrlib/merge.py:
(Merger.ensure_revision_trees, Merger.file_revisions,
Merger.check_basis, Merger.compare_basis): Deprecate.

* bzrlib/bundle/apply_bundle.py:
(merge_bundle): Replace the check_basis() call by the
corresponding code.

* bzrlib/builtins.py:
(cmd_remove_tree.run, cmd_push.run, cmd_merge.run): Use the
simplified has_changes().
(cmd_merge.run): Replace the check_basis call() by the corresponding
code (minus the alredy done has_changes() check).

Show diffs side-by-side

added added

removed removed

Lines of Context:
461
461
            raise errors.BzrCommandError("You cannot remove the working tree"
462
462
                                         " of a remote path")
463
463
        if not force:
464
 
            if (working.has_changes(working.basis_tree())
465
 
                or len(working.get_parent_ids()) > 1):
 
464
            if (working.has_changes()):
466
465
                raise errors.UncommittedChanges(working)
467
466
 
468
467
        working_path = working.bzrdir.root_transport.base
1109
1108
        else:
1110
1109
            revision_id = None
1111
1110
        if strict and tree is not None and revision_id is None:
1112
 
            if (tree.has_changes(tree.basis_tree())
1113
 
                or len(tree.get_parent_ids()) > 1):
 
1111
            if (tree.has_changes()):
1114
1112
                raise errors.UncommittedChanges(
1115
1113
                    tree, more='Use --no-strict to force the push.')
1116
1114
            if tree.last_revision() != tree.branch.last_revision():
3663
3661
 
3664
3662
        # die as quickly as possible if there are uncommitted changes
3665
3663
        if not force:
3666
 
            if tree.has_changes(basis_tree) or len(tree.get_parent_ids()) > 1:
 
3664
            if tree.has_changes():
3667
3665
                raise errors.UncommittedChanges(tree)
3668
3666
 
3669
3667
        view_info = _get_view_info_for_change_reporter(tree)
3720
3718
                                       merger.other_rev_id)
3721
3719
                    result.report(self.outf)
3722
3720
                    return 0
3723
 
            merger.check_basis(False)
 
3721
            if merger.this_basis is None:
 
3722
                raise errors.BzrCommandError(
 
3723
                    "This branch has no commits."
 
3724
                    " (perhaps you would prefer 'bzr pull')")
3724
3725
            if preview:
3725
3726
                return self._do_preview(merger, cleanups)
3726
3727
            elif interactive: