693
693
If the revision_id is a ghost, pass None for the tree.
694
694
:param allow_leftmost_as_ghost: Allow the first parent to be a ghost.
696
self.set_parent_ids(self.get_parent_ids() + [parent_tuple[0]],
696
parent_ids = self.get_parent_ids() + [parent_tuple[0]]
697
if len(parent_ids) > 1:
698
# the leftmost may have already been a ghost, preserve that if it
700
allow_leftmost_as_ghost = True
701
self.set_parent_ids(parent_ids,
697
702
allow_leftmost_as_ghost=allow_leftmost_as_ghost)
699
704
@needs_write_lock
775
780
my_file = rio_file(stanzas, header)
776
781
self._control_files.put(filename, my_file)
784
def merge_from_branch(self, branch, to_revision=None):
785
"""Merge from a branch into this working tree.
787
:param branch: The branch to merge from.
788
:param to_revision: If non-None, the merge will merge to to_revision, but
789
not beyond it. to_revision does not need to be in the history of
790
the branch when it is supplied. If None, to_revision defaults to
791
branch.last_revision().
793
from bzrlib.merge import Merger, Merge3Merger
794
pb = bzrlib.ui.ui_factory.nested_progress_bar()
796
merger = Merger(self.branch, this_tree=self, pb=pb)
797
merger.pp = ProgressPhase("Merge phase", 5, pb)
798
merger.pp.next_phase()
799
# check that there are no
801
merger.check_basis(check_clean=True, require_commits=False)
802
if to_revision is None:
803
to_revision = branch.last_revision()
804
merger.other_rev_id = to_revision
805
if merger.other_rev_id is None:
806
raise error.NoCommits(branch)
807
self.branch.fetch(branch, last_revision=merger.other_rev_id)
808
merger.other_basis = merger.other_rev_id
809
merger.other_tree = self.branch.repository.revision_tree(
811
merger.pp.next_phase()
813
if merger.base_rev_id == merger.other_rev_id:
814
raise errors.PointlessMerge
815
merger.backup_files = False
816
merger.merge_type = Merge3Merger
817
merger.set_interesting_files(None)
818
merger.show_base = False
819
merger.reprocess = False
820
conflicts = merger.do_merge()
779
827
def merge_modified(self):