~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.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:
35
35
    ui,
36
36
    versionedfile
37
37
    )
 
38
from bzrlib.symbol_versioning import (
 
39
    deprecated_in,
 
40
    deprecated_method,
 
41
    )
38
42
# TODO: Report back as changes are merged in
39
43
 
40
44
 
226
230
        revision_id = _mod_revision.ensure_null(revision_id)
227
231
        return branch, self.revision_tree(revision_id, branch)
228
232
 
 
233
    @deprecated_method(deprecated_in((2, 1, 0)))
229
234
    def ensure_revision_trees(self):
230
235
        if self.this_revision_tree is None:
231
236
            self.this_basis_tree = self.revision_tree(self.this_basis)
239
244
            other_rev_id = self.other_basis
240
245
            self.other_tree = other_basis_tree
241
246
 
 
247
    @deprecated_method(deprecated_in((2, 1, 0)))
242
248
    def file_revisions(self, file_id):
243
249
        self.ensure_revision_trees()
244
250
        def get_id(tree, file_id):
252
258
        trees = (self.this_basis_tree, self.other_tree)
253
259
        return [get_id(tree, file_id) for tree in trees]
254
260
 
 
261
    @deprecated_method(deprecated_in((2, 1, 0)))
255
262
    def check_basis(self, check_clean, require_commits=True):
256
263
        if self.this_basis is None and require_commits is True:
257
264
            raise errors.BzrCommandError(
262
269
            if self.this_basis != self.this_rev_id:
263
270
                raise errors.UncommittedChanges(self.this_tree)
264
271
 
 
272
    @deprecated_method(deprecated_in((2, 1, 0)))
265
273
    def compare_basis(self):
266
274
        try:
267
275
            basis_tree = self.revision_tree(self.this_tree.last_revision())
274
282
        self.interesting_files = file_list
275
283
 
276
284
    def set_pending(self):
277
 
        if not self.base_is_ancestor or not self.base_is_other_ancestor or self.other_rev_id is None:
 
285
        if (not self.base_is_ancestor or not self.base_is_other_ancestor
 
286
            or self.other_rev_id is None):
278
287
            return
279
288
        self._add_parent()
280
289