60
60
return tree.branch, tree
61
61
branch = Branch.open_containing(location)[0]
63
revision = branch.last_revision()
63
revision_id = branch.last_revision()
65
revision = branch.get_rev_id(revno)
67
revision = NULL_REVISION
68
return branch, _get_revid_tree(branch, revision, local_branch)
71
def _get_revid_tree(branch, revision, local_branch):
65
revision_id = branch.get_rev_id(revno)
66
if revision_id is None:
67
revision_id = NULL_REVISION
68
return branch, _get_revid_tree(branch, revision_id, local_branch)
71
def _get_revid_tree(branch, revision_id, local_branch):
72
if revision_id is None:
73
73
base_tree = branch.bzrdir.open_workingtree()
75
75
if local_branch is not None:
76
76
if local_branch.base != branch.base:
77
local_branch.fetch(branch, revision)
78
base_tree = local_branch.repository.revision_tree(revision)
77
local_branch.fetch(branch, revision_id)
78
base_tree = local_branch.repository.revision_tree(revision_id)
80
base_tree = branch.repository.revision_tree(revision)
80
base_tree = branch.repository.revision_tree(revision_id)
84
def _get_revid_tree_from_tree(tree, revision_id, local_branch):
85
if revision_id is None:
87
if local_branch is not None:
88
if local_branch.base != tree.branch.base:
89
local_branch.fetch(tree.branch, revision_id)
90
return local_branch.repository.revision_tree(revision_id)
91
return tree.branch.repository.revision_tree(revision_id)
84
94
def transform_tree(from_tree, to_tree, interesting_ids=None):
85
95
merge_inner(from_tree.branch, to_tree, from_tree, ignore_zero=True,
86
96
interesting_ids=interesting_ids, this_tree=from_tree)
256
266
except NoCommonAncestor:
257
267
raise UnrelatedBranches()
258
self.base_tree = _get_revid_tree(self.this_branch, self.base_rev_id,
268
self.base_tree = _get_revid_tree_from_tree(self.this_tree,
260
271
self.base_is_ancestor = True
262
273
base_branch, self.base_tree = _get_tree(base_revision)
1002
1013
branch.get_revision_tree(base_revision))'
1004
1015
if this_tree is None:
1005
warnings.warn("bzrlib.merge.merge_inner requires a this_tree parameter as of "
1006
"bzrlib version 0.8.",
1009
this_tree = this_branch.bzrdir.open_workingtree()
1016
raise BzrError("bzrlib.merge.merge_inner requires a this_tree "
1017
"parameter as of bzrlib version 0.8.")
1010
1018
merger = Merger(this_branch, other_tree, base_tree, this_tree=this_tree,
1011
1019
pb=pb, change_reporter=change_reporter)
1012
1020
merger.backup_files = backup_files