~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Robert Collins
  • Date: 2005-10-10 23:18:27 UTC
  • mfrom: (1437)
  • mto: This revision was merged to the branch mainline in revision 1438.
  • Revision ID: robertc@robertcollins.net-20051010231827-f9e2dda2e92bf565
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from bzrlib.errors import BzrCommandError, UnrelatedBranches, NoCommonAncestor
30
30
from bzrlib.errors import NoCommits
31
31
from bzrlib.delta import compare_trees
32
 
from bzrlib.trace import mutter, warning
 
32
from bzrlib.trace import mutter, warning, note
33
33
from bzrlib.fetch import greedy_fetch, fetch
34
34
from bzrlib.revision import is_ancestor
35
35
from bzrlib.osutils import rename
39
39
# TODO: build_working_dir can be built on something simpler than merge()
40
40
 
41
41
# FIXME: merge() parameters seem oriented towards the command line
 
42
# NOTABUG: merge is a helper for commandline functions.  merge_inner is the
 
43
#          the core functionality.
42
44
 
43
45
# comments from abentley on irc: merge happens in two stages, each
44
46
# of which generates a changeset object
140
142
    def rem_contents_conflict(self, filename, this_contents, base_contents):
141
143
        base_contents(filename+".BASE", self, False)
142
144
        this_contents(filename+".THIS", self, False)
 
145
        return ReplaceContents(this_contents, None)
 
146
 
 
147
    def rem_contents_conflict(self, filename, this_contents, base_contents):
 
148
        base_contents(filename+".BASE", self, False)
 
149
        this_contents(filename+".THIS", self, False)
143
150
        self.conflict("Other branch deleted locally modified file %s" %
144
151
                      filename)
145
152
        return ReplaceContents(this_contents, None)
185
192
 
186
193
    def finalize(self):
187
194
        if not self.ignore_zero:
188
 
            print "%d conflicts encountered.\n" % self.conflicts
 
195
            note("%d conflicts encountered.\n" % self.conflicts)
189
196
            
190
197
def get_tree(treespec, temp_root, label, local_branch=None):
191
198
    location, revno = treespec
405
412
             source_file.interesting = source_file.id in interesting_ids
406
413
 
407
414
 
408
 
def generate_cset_optimized(tree_a, tree_b, interesting_ids=None):
409
 
    """Generate a changeset.  If interesting_ids is supplied, only changes
410
 
    to those files will be shown.  Metadata changes are stripped.
411
 
    """ 
412
 
    cset =  generate_changeset(tree_a, tree_b, interesting_ids)
413
 
    for entry in cset.entries.itervalues():
414
 
        entry.metadata_change = None
415
 
    return cset
416
 
 
417
 
 
418
415
def merge_inner(this_branch, other_tree, base_tree, tempdir, 
419
416
                ignore_zero=False, merge_type=ApplyMerge3, backup_files=False,
420
417
                interesting_ids=None):
431
428
        return tree.tree.inventory
432
429
 
433
430
    inv_changes = merge_flex(this_tree, base_tree, other_tree,
434
 
                             generate_cset_optimized, get_inventory,
 
431
                             generate_changeset, get_inventory,
435
432
                             MergeConflictHandler(this_tree, base_tree,
436
433
                             other_tree, ignore_zero=ignore_zero),
437
434
                             merge_factory=merge_factory,