~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Aaron Bentley
  • Date: 2005-09-14 16:35:46 UTC
  • mto: (1185.1.16)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: abentley@panoramicfeedback.com-20050914163546-ef044baf4ef9c135
Improved merge error handling and testing

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.changeset import generate_changeset, ExceptionConflictHandler
28
28
from bzrlib.changeset import Inventory, Diff3Merge
29
29
from bzrlib.branch import find_branch
30
 
from bzrlib.errors import BzrCommandError, UnrelatedBranches
 
30
from bzrlib.errors import BzrCommandError, UnrelatedBranches, NoCommonAncestor
 
31
from bzrlib.errors import NoCommits
31
32
from bzrlib.delta import compare_trees
32
33
from bzrlib.trace import mutter, warning
33
34
from bzrlib.fetch import greedy_fetch
256
257
                                            this_branch)
257
258
        if other_revision[1] == -1:
258
259
            other_rev_id = other_branch.last_patch()
 
260
            if other_rev_id is None:
 
261
                raise NoCommits(other_branch)
259
262
            other_basis = other_rev_id
260
263
        elif other_revision[1] is not None:
261
264
            other_rev_id = other_branch.lookup_revision(other_revision[1])
263
266
        else:
264
267
            other_rev_id = None
265
268
            other_basis = other_branch.last_patch()
 
269
            if other_basis is None:
 
270
                raise NoCommits(other_branch)
266
271
        if base_revision == [None, None]:
267
 
            base_rev_id = common_ancestor(this_rev_id, other_basis, 
268
 
                                          this_branch)
269
 
            if base_rev_id is None:
 
272
            try:
 
273
                base_rev_id = common_ancestor(this_rev_id, other_basis, 
 
274
                                              this_branch)
 
275
            except NoCommonAncestor:
270
276
                raise UnrelatedBranches()
271
277
            base_tree = get_revid_tree(this_branch, base_rev_id, tempdir, 
272
278
                                       "base", None)