899 a = "1\n2\n3\n4\n" |
899 a = "1\n2\n3\n4\n" |
900 b = "1\n2\n3\ninsert\n4\n" |
900 b = "1\n2\n3\ninsert\n4\n" |
901 fa = writetemp(a) |
901 fa = writetemp(a) |
902 d = mdiff.unidiff(a, None, b, None, os.path.basename(fa)) |
902 d = mdiff.unidiff(a, None, b, None, os.path.basename(fa)) |
903 fd = writetemp(d) |
903 fd = writetemp(d) |
904 |
904 |
905 files = {} |
905 files = {} |
906 try: |
906 try: |
907 patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files) |
907 patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files) |
908 except util.Abort, e: |
908 except util.Abort, e: |
909 ui.write(_(" patch call failed:\n")) |
909 ui.write(_(" patch call failed:\n")) |
910 ui.write(" " + str(e) + "\n") |
910 ui.write(" " + str(e) + "\n") |
911 problems += 1 |
911 problems += 1 |
912 else: |
912 else: |
913 if list(files) != [os.path.basename(fa)]: |
913 if list(files) != [os.path.basename(fa)]: |
914 ui.write(_(" unexpected patch output!")) |
914 ui.write(_(" unexpected patch output!")) |
915 ui.write(_(" (you may have an incompatible version of patch)\n")) |
915 ui.write(_(" (you may have an incompatible version of patch)\n")) |
916 problems += 1 |
916 problems += 1 |
917 a = file(fa).read() |
917 a = file(fa).read() |
918 if a != b: |
918 if a != b: |
919 ui.write(_(" patch test failed!")) |
919 ui.write(_(" patch test failed!")) |
920 ui.write(_(" (you may have an incompatible version of patch)\n")) |
920 ui.write(_(" (you may have an incompatible version of patch)\n")) |
921 problems += 1 |
921 problems += 1 |
922 |
922 |
923 os.unlink(fa) |
923 os.unlink(fa) |
924 os.unlink(fd) |
924 os.unlink(fd) |
925 |
925 |
926 # merge helper |
926 # merge helper |
927 ui.status(_("Checking merge helper...\n")) |
927 ui.status(_("Checking merge helper...\n")) |