~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Martin Pool
  • Date: 2005-09-16 03:32:44 UTC
  • mfrom: (1185.1.23)
  • mto: (1185.8.2) (974.1.91)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: mbp@sourcefrog.net-20050916033244-18c4f4bcba663e42
- merge in many integration fixes from Robert

  * xml escaping of unprintable characters

  * 'make clean'

  * new, more consistent Branch constructors 

  * RemoteBranch tests against local farmework

  * scott's non-verbose commit fix 

This seems to break this usage though 

  bzr diff -r 1207..1208 ../bzr.robertc-integration

robertc@robertcollins.net-20050915175953-a16fdc627ce7c541

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.merge_core import merge_flex, ApplyMerge3, BackupBeforeChange
27
27
from bzrlib.changeset import generate_changeset, ExceptionConflictHandler
28
28
from bzrlib.changeset import Inventory, Diff3Merge
29
 
from bzrlib.branch import find_branch
30
 
from bzrlib.errors import BzrCommandError, UnrelatedBranches
 
29
from bzrlib.branch import Branch
 
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
133
134
            
134
135
def get_tree(treespec, temp_root, label, local_branch=None):
135
136
    location, revno = treespec
136
 
    branch = find_branch(location)
 
137
    branch = Branch.open(location)
137
138
    if revno is None:
138
139
        revision = None
139
140
    elif revno == -1:
140
141
        revision = branch.last_patch()
141
142
    else:
142
 
        revision = branch.lookup_revision(revno)
 
143
        revision = branch.get_rev_id(revno)
143
144
    return branch, get_revid_tree(branch, revision, temp_root, label,
144
145
                                  local_branch)
145
146
 
243
244
    try:
244
245
        if this_dir is None:
245
246
            this_dir = '.'
246
 
        this_branch = find_branch(this_dir)
 
247
        this_branch = Branch.open_containing(this_dir)
247
248
        this_rev_id = this_branch.last_patch()
248
249
        if this_rev_id is None:
249
250
            raise BzrCommandError("This branch has no commits")
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
 
            other_rev_id = other_branch.lookup_revision(other_revision[1])
 
264
            other_rev_id = other_branch.get_rev_id(other_revision[1])
262
265
            other_basis = other_rev_id
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)
278
284
            elif base_revision[1] is None:
279
285
                base_rev_id = None
280
286
            else:
281
 
                base_rev_id = base_branch.lookup_revision(base_revision[1])
 
287
                base_rev_id = base_branch.get_rev_id(base_revision[1])
282
288
            if base_rev_id is not None:
283
289
                base_is_ancestor = is_ancestor(this_rev_id, base_rev_id, 
284
290
                                               MultipleRevisionSources(this_branch,