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)