~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Aaron Bentley
  • Date: 2005-07-29 17:19:16 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1020.
  • Revision ID: abentley@panoramicfeedback.com-20050729171916-322fd81b451d2e3e
Added merge-type parameter to merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
 
166
166
def merge(other_revision, base_revision,
167
167
          check_clean=True, ignore_zero=False,
168
 
          this_dir=None, backup_files=False):
 
168
          this_dir=None, backup_files=False, merge_type=ApplyMerge3):
169
169
    """Merge changes into a tree.
170
170
 
171
171
    base_revision
201
201
            base_revision = ['.', base_revno]
202
202
        base_branch, base_tree = get_tree(base_revision, tempdir, "base")
203
203
        merge_inner(this_branch, other_tree, base_tree, tempdir, 
204
 
                    ignore_zero=ignore_zero, backup_files=backup_files)
 
204
                    ignore_zero=ignore_zero, backup_files=backup_files, 
 
205
                    merge_type=merge_type)
205
206
    finally:
206
207
        shutil.rmtree(tempdir)
207
208
 
231
232
 
232
233
 
233
234
def merge_inner(this_branch, other_tree, base_tree, tempdir, 
234
 
                ignore_zero=False, merge_type="diff3", backup_files=False):
235
 
    merge_types = {"merge3": ApplyMerge3, 
236
 
                   "diff3": Diff3Merge}
 
235
                ignore_zero=False, merge_type=ApplyMerge3, backup_files=False):
237
236
 
238
237
    def merge_factory(base_file, other_file):
239
 
        contents_change = merge_types[merge_type](base_file, other_file)
 
238
        contents_change = merge_type(base_file, other_file)
240
239
        if backup_files:
241
240
            contents_change = BackupBeforeChange(contents_change)
242
241
        return contents_change
304
303
    assert len(new_inventory_list) == len(old_entries) + insertions - deletions
305
304
    new_inventory_list.sort()
306
305
    return new_inventory_list
 
306
 
 
307
merge_types = {     "merge3": (ApplyMerge3, "Native diff3-style merge"), 
 
308
                     "diff3": (Diff3Merge,  "Merge using external diff3")
 
309
              }
 
310