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