Show More
@@ -19,7 +19,6 b' from .node import (' | |||
|
19 | 19 | ) |
|
20 | 20 | from .pycompat import ( |
|
21 | 21 | getattr, |
|
22 | open, | |
|
23 | 22 | ) |
|
24 | 23 | |
|
25 | 24 | from . import ( |
@@ -923,30 +922,24 b' def _maketempfiles(fco, fca, localpath):' | |||
|
923 | 922 | """ |
|
924 | 923 | tmproot = pycompat.mkdtemp(prefix=b'hgmerge-') |
|
925 | 924 | |
|
926 | def maketempfrompath(prefix, path): | |
|
925 | def maketempfrompath(prefix, path, data): | |
|
927 | 926 | fullbase, ext = os.path.splitext(path) |
|
928 | 927 | pre = b"%s~%s" % (os.path.basename(fullbase), prefix) |
|
929 | 928 | name = os.path.join(tmproot, pre) |
|
930 | 929 | if ext: |
|
931 | 930 | name += ext |
|
932 | f = open(name, "wb") | |
|
933 |
return |
|
|
931 | util.writefile(name, data) | |
|
932 | return name | |
|
934 | 933 | |
|
935 | 934 | def tempfromcontext(prefix, ctx): |
|
936 |
|
|
|
937 | data = ctx.decodeddata() | |
|
938 | f.write(data) | |
|
939 | f.close() | |
|
940 | return name | |
|
935 | return maketempfrompath(prefix, ctx.path(), ctx.decodeddata()) | |
|
941 | 936 | |
|
942 | 937 | b = tempfromcontext(b"base", fca) |
|
943 | 938 | c = tempfromcontext(b"other", fco) |
|
944 | 939 | d = localpath |
|
945 | 940 | if localpath is not None: |
|
946 | f, d = maketempfrompath(b"local", d) | |
|
947 | 941 | data = util.readfile(localpath) |
|
948 | f.write(data) | |
|
949 | f.close() | |
|
942 | d = maketempfrompath(b"local", localpath, data) | |
|
950 | 943 | |
|
951 | 944 | try: |
|
952 | 945 | yield b, c, d |
General Comments 0
You need to be logged in to leave comments.
Login now