280
280
hooks = MergeHooks()
282
282
def __init__(self, this_branch, other_tree=None, base_tree=None,
283
this_tree=None, pb=None, change_reporter=None,
283
this_tree=None, change_reporter=None,
284
284
recurse='down', revision_graph=None):
285
285
object.__init__(self)
286
286
self.this_branch = this_branch
354
352
_set_base_is_other_ancestor)
357
def from_uncommitted(tree, other_tree, pb=None, base_tree=None):
355
def from_uncommitted(tree, other_tree, base_tree=None):
358
356
"""Return a Merger for uncommitted changes in other_tree.
360
358
:param tree: The tree to merge into
361
359
:param other_tree: The tree to get uncommitted changes from
362
:param pb: A progress indicator
363
360
:param base_tree: The basis to use for the merge. If unspecified,
364
361
other_tree.basis_tree() will be used.
366
363
if base_tree is None:
367
364
base_tree = other_tree.basis_tree()
368
merger = Merger(tree.branch, other_tree, base_tree, tree, pb)
365
merger = Merger(tree.branch, other_tree, base_tree, tree)
369
366
merger.base_rev_id = merger.base_tree.get_revision_id()
370
367
merger.other_rev_id = None
371
368
merger.other_basis = merger.base_rev_id
375
def from_mergeable(klass, tree, mergeable, pb):
372
def from_mergeable(klass, tree, mergeable):
376
373
"""Return a Merger for a bundle or merge directive.
378
375
:param tree: The tree to merge changes into
379
376
:param mergeable: A merge directive or bundle
380
:param pb: A progress indicator
382
378
mergeable.install_revisions(tree.branch.repository)
383
379
base_revision_id, other_revision_id, verified =\
390
386
base_revision_id = None
392
388
trace.warning('Performing cherrypick')
393
merger = klass.from_revision_ids(pb, tree, other_revision_id,
389
merger = klass.from_revision_ids(tree, other_revision_id,
394
390
base_revision_id, revision_graph=
396
392
return merger, verified
399
def from_revision_ids(pb, tree, other, base=None, other_branch=None,
395
def from_revision_ids(tree, other, base=None, other_branch=None,
400
396
base_branch=None, revision_graph=None,
401
397
tree_branch=None):
402
398
"""Return a Merger for revision-ids.
404
:param pb: A progress indicator
405
400
:param tree: The tree to merge changes into
406
401
:param other: The revision-id to use as OTHER
407
402
:param base: The revision-id to use as BASE. If not specified, will
418
413
if tree_branch is None:
419
414
tree_branch = tree.branch
420
merger = Merger(tree_branch, this_tree=tree, pb=pb,
415
merger = Merger(tree_branch, this_tree=tree,
421
416
revision_graph=revision_graph)
422
417
if other_branch is None:
423
418
other_branch = tree.branch
642
637
if self._is_criss_cross and getattr(self.merge_type,
643
638
'supports_lca_trees', False):
644
639
kwargs['lca_trees'] = self._lca_trees
645
return self.merge_type(pb=None,
646
change_reporter=self.change_reporter,
640
return self.merge_type(change_reporter=self.change_reporter,
649
643
def _do_merge_to(self):
726
720
def __init__(self, working_tree, this_tree, base_tree, other_tree,
727
721
interesting_ids=None, reprocess=False, show_base=False,
728
pb=None, pp=None, change_reporter=None,
729
interesting_files=None, do_merge=True,
722
change_reporter=None, interesting_files=None, do_merge=True,
730
723
cherrypick=False, lca_trees=None, this_branch=None,
731
724
other_branch=None):
732
725
"""Initialize the merger object and perform the merge.
744
737
:param: reprocess If True, perform conflict-reduction processing.
745
738
:param show_base: If True, show the base revision in text conflicts.
746
739
(incompatible with reprocess)
748
:param pp: A ProgressPhase object
749
740
:param change_reporter: An object that should report changes made
750
741
:param interesting_files: The tree-relative paths of files that should
751
742
participate in the merge. If these paths refer to directories,
785
776
self.cherrypick = cherrypick
789
warnings.warn("pp argument to Merge3Merger is deprecated")
791
warnings.warn("pb argument to Merge3Merger is deprecated")
793
780
def do_merge(self):
794
781
operation = cleanup.OperationWithCleanups(self._do_merge)
1935
1921
raise errors.BzrError("breezy.merge.merge_inner requires a this_tree "
1937
1923
merger = Merger(this_branch, other_tree, base_tree, this_tree=this_tree,
1938
pb=pb, change_reporter=change_reporter)
1924
change_reporter=change_reporter)
1939
1925
merger.backup_files = backup_files
1940
1926
merger.merge_type = merge_type
1941
1927
merger.interesting_ids = interesting_ids