Show More
@@ -863,42 +863,40 b' def debuginstall(ui):' | |||
|
863 | 863 | |
|
864 | 864 | # patch |
|
865 | 865 | ui.status(_("Checking patch...\n")) |
|
866 | patcher = ui.config('ui', 'patch') | |
|
867 | patcher = ((patcher and util.find_exe(patcher)) or | |
|
868 | util.find_exe('gpatch') or | |
|
869 | util.find_exe('patch')) | |
|
870 | if not patcher: | |
|
871 | ui.write(_(" Can't find patch or gpatch in PATH\n")) | |
|
872 | ui.write(_(" (specify a patch utility in your .hgrc file)\n")) | |
|
873 | problems += 1 | |
|
866 | patchproblems = 0 | |
|
867 | a = "1\n2\n3\n4\n" | |
|
868 | b = "1\n2\n3\ninsert\n4\n" | |
|
869 | fa = writetemp(a) | |
|
870 | d = mdiff.unidiff(a, None, b, None, os.path.basename(fa)) | |
|
871 | fd = writetemp(d) | |
|
872 | ||
|
873 | files = {} | |
|
874 | try: | |
|
875 | patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files) | |
|
876 | except util.Abort, e: | |
|
877 | ui.write(_(" patch call failed:\n")) | |
|
878 | ui.write(" " + str(e) + "\n") | |
|
879 | patchproblems += 1 | |
|
874 | 880 | else: |
|
875 | # actually attempt a patch here | |
|
876 | a = "1\n2\n3\n4\n" | |
|
877 | b = "1\n2\n3\ninsert\n4\n" | |
|
878 |
|
|
|
879 | d = mdiff.unidiff(a, None, b, None, os.path.basename(fa)) | |
|
880 | fd = writetemp(d) | |
|
881 | ||
|
882 | files = {} | |
|
883 | try: | |
|
884 | patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files) | |
|
885 | except util.Abort, e: | |
|
886 | ui.write(_(" patch call failed:\n")) | |
|
887 | ui.write(" " + str(e) + "\n") | |
|
888 | problems += 1 | |
|
881 | if list(files) != [os.path.basename(fa)]: | |
|
882 | ui.write(_(" unexpected patch output!\n")) | |
|
883 | patchproblems += 1 | |
|
884 | a = file(fa).read() | |
|
885 | if a != b: | |
|
886 | ui.write(_(" patch test failed!\n")) | |
|
887 | patchproblems += 1 | |
|
888 | ||
|
889 | if patchproblems: | |
|
890 | if ui.config('ui', 'patch'): | |
|
891 | ui.write(_(" (Current patch tool may be incompatible with patch," | |
|
892 | " or misconfigured. Please check your .hgrc file)\n")) | |
|
889 | 893 | else: |
|
890 | if list(files) != [os.path.basename(fa)]: | |
|
891 | ui.write(_(" unexpected patch output!")) | |
|
892 | ui.write(_(" (you may have an incompatible version of patch)\n")) | |
|
893 | problems += 1 | |
|
894 | a = file(fa).read() | |
|
895 | if a != b: | |
|
896 | ui.write(_(" patch test failed!")) | |
|
897 | ui.write(_(" (you may have an incompatible version of patch)\n")) | |
|
898 | problems += 1 | |
|
899 | ||
|
900 | os.unlink(fa) | |
|
901 | os.unlink(fd) | |
|
894 | ui.write(_(" Internal patcher failure, please report this error" | |
|
895 | " to http://www.selenic.com/mercurial/bts\n")) | |
|
896 | problems += patchproblems | |
|
897 | ||
|
898 | os.unlink(fa) | |
|
899 | os.unlink(fd) | |
|
902 | 900 | |
|
903 | 901 | # merge helper |
|
904 | 902 | ui.status(_("Checking merge helper...\n")) |
General Comments 0
You need to be logged in to leave comments.
Login now