~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Robert Collins
  • Date: 2005-08-25 10:04:51 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050825100451-b01297285491ba46
make a default merge choose a sane base with branch.common_ancestor

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib.changeset import generate_changeset, ExceptionConflictHandler
20
20
from bzrlib.changeset import Inventory, Diff3Merge
21
21
from bzrlib.branch import find_branch
 
22
from bzrlib.revision import is_ancestor
22
23
import bzrlib.osutils
23
24
from bzrlib.errors import BzrCommandError, UnrelatedBranches
24
25
from bzrlib.delta import compare_trees
218
219
    """Merge changes into a tree.
219
220
 
220
221
    base_revision
221
 
        Base for three-way merge.
 
222
        tuple(path, revision) Base for three-way merge.
222
223
    other_revision
223
 
        Other revision for three-way merge.
 
224
        tuple(path, revision) Other revision for three-way merge.
224
225
    this_dir
225
226
        Directory to merge changes into; '.' by default.
226
227
    check_clean
270
271
                                       "base")
271
272
            base_is_ancestor = True
272
273
        else:
273
 
            base_branch, base_tree = get_tree(base_revision, tempdir, "base")
274
274
            if base_revision[1] == -1:
 
275
                base_branch, base_tree = get_tree(base_revision, tempdir, "base")
275
276
                base_rev_id = base_branch.last_patch()
276
277
            elif base_revision[1] is None:
277
 
                base_rev_id = None
 
278
                base_revno, base_rev_id = this_branch.common_ancestor(other_branch)
 
279
                base_branch, base_tree = get_tree((base_revision[0], "revid:%s" % base_rev_id), tempdir, "base")
278
280
            else:
 
281
                base_branch, base_tree = get_tree(base_revision, tempdir, "base")
279
282
                base_rev_id = base_branch.lookup_revision(base_revision[1])
280
283
            if base_rev_id is not None:
281
284
                base_is_ancestor = is_ancestor(this_rev_id, base_rev_id,