198
198
def create(self, file_id, path, tree):
199
199
"""Uses tree data to create a filesystem object for the file_id"""
200
from _changeset import get_contents
200
from bzrlib._changeset import get_contents
201
201
get_contents(tree, file_id)(path, self)
203
203
def missing_for_merge(self, file_id, other_path):
239
239
base_tree = branch.working_tree()
241
241
if local_branch is not None:
242
greedy_fetch(local_branch, branch, revision)
243
base_tree = local_branch.revision_tree(revision)
242
if local_branch.base != branch.base:
243
greedy_fetch(local_branch, branch, revision)
244
base_tree = local_branch.repository.revision_tree(revision)
245
base_tree = branch.revision_tree(revision)
246
base_tree = branch.repository.revision_tree(revision)
268
269
interesting_ids=interesting_ids)
271
def merge(other_revision, base_revision,
272
check_clean=True, ignore_zero=False,
273
this_dir=None, backup_files=False, merge_type=ApplyMerge3,
274
file_list=None, show_base=False, reprocess=False):
275
"""Merge changes into a tree.
278
list(path, revno) Base for three-way merge.
279
If [None, None] then a base will be automatically determined.
281
list(path, revno) Other revision for three-way merge.
283
Directory to merge changes into; '.' by default.
285
If true, this_dir must have no uncommitted changes before the
287
ignore_zero - If true, suppress the "zero conflicts" message when
288
there are no conflicts; should be set when doing something we expect
289
to complete perfectly.
290
file_list - If supplied, merge only changes to selected files.
292
All available ancestors of other_revision and base_revision are
293
automatically pulled into the branch.
295
The revno may be -1 to indicate the last revision on the branch, which is
298
This function is intended for use from the command line; programmatic
299
clients might prefer to call merge_inner(), which has less magic behavior.
303
this_branch = Branch.open_containing(this_dir)[0]
304
if show_base and not merge_type is ApplyMerge3:
305
raise BzrCommandError("Show-base is not supported for this merge"
306
" type. %s" % merge_type)
307
if reprocess and not merge_type is ApplyMerge3:
308
raise BzrCommandError("Reprocess is not supported for this merge"
309
" type. %s" % merge_type)
310
if reprocess and show_base:
311
raise BzrCommandError("Cannot reprocess and show base.")
312
merger = Merger(this_branch)
313
merger.check_basis(check_clean)
314
merger.set_other(other_revision)
315
merger.set_base(base_revision)
316
if merger.base_rev_id == merger.other_rev_id:
317
note('Nothing to do.')
319
merger.backup_files = backup_files
320
merger.merge_type = merge_type
321
merger.set_interesting_files(file_list)
322
merger.show_base = show_base
323
merger.reprocess = reprocess
324
merger.conflict_handler = _MergeConflictHandler(merger.this_tree,
327
ignore_zero=ignore_zero)
328
conflicts = merger.do_merge()
333
272
def merge_inner(this_branch, other_tree, base_tree, ignore_zero=False,
334
273
backup_files=False,
335
274
merge_type=ApplyMerge3,
382
321
base_tree, other_tree)
384
323
def revision_tree(self, revision_id):
385
return self.this_branch.revision_tree(revision_id)
324
return self.this_branch.repository.revision_tree(revision_id)
387
326
def ensure_revision_trees(self):
388
327
if self.this_revision_tree is None:
389
self.this_basis_tree = self.this_branch.revision_tree(
328
self.this_basis_tree = self.this_branch.repository.revision_tree(
391
330
if self.this_basis == self.this_rev_id:
392
331
self.this_revision_tree = self.this_basis_tree
499
438
self.other_basis = other_branch.last_revision()
500
439
if self.other_basis is None:
501
440
raise NoCommits(other_branch)
502
fetch(from_branch=other_branch, to_branch=self.this_branch,
503
last_revision=self.other_basis)
441
if other_branch.base != self.this_branch.base:
442
fetch(from_branch=other_branch, to_branch=self.this_branch,
443
last_revision=self.other_basis)
505
445
def set_base(self, base_revision):
506
446
mutter("doing merge() with no base_revision specified")