89
89
self.change_reporter = change_reporter
90
90
self._cached_trees = {}
93
def from_uncommitted(tree, other_tree, pb):
94
"""Return a Merger for uncommitted changes in other_tree.
96
:param tree: The tree to merge into
97
:param other_tree: The tree to get uncommitted changes from
98
:param pb: A progress indicator
100
merger = Merger(tree.branch, other_tree, other_tree.basis_tree(), tree,
102
merger.base_rev_id = merger.base_tree.get_revision_id()
103
merger.other_rev_id = None
107
def from_mergeable(klass, tree, mergeable, pb):
108
"""Return a Merger for a bundle or merge directive.
110
:param tree: The tree to merge changes into
111
:param mergeable: A merge directive or bundle
112
:param pb: A progress indicator
114
mergeable.install_revisions(tree.branch.repository)
115
base_revision_id, other_revision_id, verified =\
116
mergeable.get_merge_request(tree.branch.repository)
117
if (base_revision_id != _mod_revision.NULL_REVISION and
118
tree.branch.repository.get_graph().is_ancestor(
119
base_revision_id, tree.branch.last_revision())):
120
base_revision_id = None
121
merger = klass.from_revision_ids(pb, tree, other_revision_id,
123
return merger, verified
126
def from_revision_ids(pb, this, other, base=None, other_branch=None,
128
"""Return a Merger for revision-ids.
130
:param tree: The tree to merge changes into
131
:param other: The revision-id to use as OTHER
132
:param base: The revision-id to use as BASE. If not specified, will
134
:param other_branch: A branch containing the other revision-id. If
135
not supplied, this.branch is used.
136
:param base_branch: A branch containing the base revision-id. If
137
not supplied, other_branch or this.branch will be used.
138
:param pb: A progress indicator
140
merger = Merger(this.branch, this_tree=this, pb=pb)
141
if other_branch is None:
142
other_branch = this.branch
143
merger.set_other_revision(other, other_branch)
147
if base_branch is None:
148
base_branch = other_branch
149
merger.set_base_revision(base, base_branch)
92
152
def revision_tree(self, revision_id, branch=None):
93
153
if revision_id not in self._cached_trees:
94
154
if branch is None: