~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_core.py

MergeĀ fromĀ jam-integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from os import fdopen
1
2
import os.path
 
3
from tempfile import mkstemp
2
4
 
3
5
import changeset
4
6
from changeset import Inventory, apply_changeset, invert_dict
37
39
        return not (self == other)
38
40
 
39
41
    def apply(self, filename, conflict_handler):
40
 
        new_file = filename+".new" 
 
42
        output_file, new_file = mkstemp(dir=os.path.dirname(filename),
 
43
                                        prefix=os.path.basename(filename))
 
44
        output_file = fdopen(output_file, 'wb')
41
45
        base = self.base
42
46
        other = self.other
43
47
        def get_lines(tree):
50
54
        m3 = Merge3(base_lines, file(filename, "rb").readlines(), other_lines)
51
55
 
52
56
        new_conflicts = False
53
 
        output_file = file(new_file, "wb")
54
57
        start_marker = "!START OF MERGE CONFLICT!" + "I HOPE THIS IS UNIQUE"
55
58
        if self.show_base is True:
56
59
            base_marker = '|' * 7