Show More
@@ -891,27 +891,28 b' def debuginstall(ui):' | |||
|
891 | 891 | # actually attempt a patch here |
|
892 | 892 | a = "1\n2\n3\n4\n" |
|
893 | 893 | b = "1\n2\n3\ninsert\n4\n" |
|
894 | d = mdiff.unidiff(a, None, b, None, "a") | |
|
895 | 894 | fa = writetemp(a) |
|
895 | d = mdiff.unidiff(a, None, b, None, os.path.basename(fa)) | |
|
896 | 896 | fd = writetemp(d) |
|
897 | fp = os.popen('%s %s %s' % (patcher, fa, fd)) | |
|
898 |
files = |
|
|
899 | output = "" | |
|
900 | for line in fp: | |
|
901 | output += line | |
|
902 | if line.startswith('patching file '): | |
|
903 | pf = util.parse_patch_output(line.rstrip()) | |
|
904 | files.append(pf) | |
|
905 | if files != [fa]: | |
|
906 | ui.write(_(" unexpected patch output!")) | |
|
907 | ui.write(_(" (you may have an incompatible version of patch)\n")) | |
|
908 | ui.write(output) | |
|
897 | ||
|
898 | files = {} | |
|
899 | try: | |
|
900 | patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files) | |
|
901 | except util.Abort, e: | |
|
902 | ui.write(_(" patch call failed:\n")) | |
|
903 | ui.write(" " + str(e) + "\n") | |
|
909 | 904 | problems += 1 |
|
910 | a = file(fa).read() | |
|
911 | if a != b: | |
|
912 |
ui.write(_(" patch |
|
|
913 | ui.write(_(" (you may have an incompatible version of patch)\n")) | |
|
914 | problems += 1 | |
|
905 | else: | |
|
906 | if list(files) != [os.path.basename(fa)]: | |
|
907 | ui.write(_(" unexpected patch output!")) | |
|
908 | ui.write(_(" (you may have an incompatible version of patch)\n")) | |
|
909 | problems += 1 | |
|
910 | a = file(fa).read() | |
|
911 | if a != b: | |
|
912 | ui.write(_(" patch test failed!")) | |
|
913 | ui.write(_(" (you may have an incompatible version of patch)\n")) | |
|
914 | problems += 1 | |
|
915 | ||
|
915 | 916 | os.unlink(fa) |
|
916 | 917 | os.unlink(fd) |
|
917 | 918 |
General Comments 0
You need to be logged in to leave comments.
Login now