##// END OF EJS Templates
debuginstall: stop looking for patch utility, just test it
Patrick Mezard -
r5310:ba3dc788 default
parent child Browse files
Show More
@@ -863,16 +863,7 b' def debuginstall(ui):'
863
863
864 # patch
864 # patch
865 ui.status(_("Checking patch...\n"))
865 ui.status(_("Checking patch...\n"))
866 patcher = ui.config('ui', 'patch')
866 patchproblems = 0
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
874 else:
875 # actually attempt a patch here
876 a = "1\n2\n3\n4\n"
867 a = "1\n2\n3\n4\n"
877 b = "1\n2\n3\ninsert\n4\n"
868 b = "1\n2\n3\ninsert\n4\n"
878 fa = writetemp(a)
869 fa = writetemp(a)
@@ -885,17 +876,24 b' def debuginstall(ui):'
885 except util.Abort, e:
876 except util.Abort, e:
886 ui.write(_(" patch call failed:\n"))
877 ui.write(_(" patch call failed:\n"))
887 ui.write(" " + str(e) + "\n")
878 ui.write(" " + str(e) + "\n")
888 problems += 1
879 patchproblems += 1
889 else:
880 else:
890 if list(files) != [os.path.basename(fa)]:
881 if list(files) != [os.path.basename(fa)]:
891 ui.write(_(" unexpected patch output!"))
882 ui.write(_(" unexpected patch output!\n"))
892 ui.write(_(" (you may have an incompatible version of patch)\n"))
883 patchproblems += 1
893 problems += 1
894 a = file(fa).read()
884 a = file(fa).read()
895 if a != b:
885 if a != b:
896 ui.write(_(" patch test failed!"))
886 ui.write(_(" patch test failed!\n"))
897 ui.write(_(" (you may have an incompatible version of patch)\n"))
887 patchproblems += 1
898 problems += 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"))
893 else:
894 ui.write(_(" Internal patcher failure, please report this error"
895 " to http://www.selenic.com/mercurial/bts\n"))
896 problems += patchproblems
899
897
900 os.unlink(fa)
898 os.unlink(fa)
901 os.unlink(fd)
899 os.unlink(fd)
General Comments 0
You need to be logged in to leave comments. Login now