~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2009-07-02 13:07:14 UTC
  • mto: (4524.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4525.
  • Revision ID: v.ladeuil+lp@free.fr-20090702130714-hsyqfusi8vn3a11m
Use tree.has_changes() where appropriate (the test suite caught a
bug in has_changes() (not filtering out the root) in an impressive
number of tests)

* bzrlib/send.py:
(send): Use tree.has_changes() instead of tree.changes_from().

* bzrlib/reconfigure.py:
(Reconfigure._check): Use tree.has_changes() instead of
tree.changes_from().

* bzrlib/merge.py:
(Merger.ensure_revision_trees, Merger.compare_basis): Use
tree.has_changes() instead of tree.changes_from().

* bzrlib/builtins.py:
(cmd_remove_tree.run, cmd_push.run, cmd_merge.run): Use
tree.has_changes() instead of tree.changes_from().

Show diffs side-by-side

added added

removed removed

Lines of Context:
450
450
        except errors.NoWorkingTree:
451
451
            raise errors.BzrCommandError("No working tree to remove")
452
452
        except errors.NotLocalUrl:
453
 
            raise errors.BzrCommandError("You cannot remove the working tree of a "
454
 
                                         "remote path")
 
453
            raise errors.BzrCommandError("You cannot remove the working tree"
 
454
                                         " of a remote path")
455
455
        if not force:
456
 
            changes = working.changes_from(working.basis_tree())
457
 
            if changes.has_changed():
 
456
            # XXX: What about pending merges ? -- vila 20090629
 
457
            if working.has_changes(working.basis_tree()):
458
458
                raise errors.UncommittedChanges(working)
459
459
 
460
460
        working_path = working.bzrdir.root_transport.base
461
461
        branch_path = working.branch.bzrdir.root_transport.base
462
462
        if working_path != branch_path:
463
 
            raise errors.BzrCommandError("You cannot remove the working tree from "
464
 
                                         "a lightweight checkout")
 
463
            raise errors.BzrCommandError("You cannot remove the working tree"
 
464
                                         " from a lightweight checkout")
465
465
 
466
466
        d.destroy_workingtree()
467
467
 
1115
1115
            revision_id = None
1116
1116
        if (tree is not None and revision_id is None
1117
1117
            and (strict is None or strict)): # Default to True:
1118
 
            changes = tree.changes_from(tree.basis_tree())
1119
 
            if changes.has_changed() or len(tree.get_parent_ids()) > 1:
 
1118
            if (tree.has_changes(tree.basis_tree())
 
1119
                 or len(tree.get_parent_ids()) > 1):
1120
1120
                raise errors.UncommittedChanges(
1121
1121
                    tree, more='Use --no-strict to force the push.')
1122
1122
            if tree.last_revision() != tree.branch.last_revision():
3642
3642
        except errors.NoSuchRevision:
3643
3643
            basis_tree = tree.basis_tree()
3644
3644
        if not force:
3645
 
            changes = tree.changes_from(basis_tree)
3646
 
            if changes.has_changed():
 
3645
            if tree.has_changes(basis_tree):
3647
3646
                raise errors.UncommittedChanges(tree)
3648
3647
 
3649
3648
        view_info = _get_view_info_for_change_reporter(tree)