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 |
|
|
867 | a = "1\n2\n3\n4\n" | |
877 |
|
|
868 | b = "1\n2\n3\ninsert\n4\n" | |
878 |
|
|
869 | fa = writetemp(a) | |
@@ -885,17 +876,24 b' def debuginstall(ui):' | |||||
885 |
|
|
876 | except util.Abort, e: | |
886 |
|
|
877 | ui.write(_(" patch call failed:\n")) | |
887 |
|
|
878 | ui.write(" " + str(e) + "\n") | |
888 |
|
|
879 | patchproblems += 1 | |
889 |
|
|
880 | else: | |
890 |
|
|
881 | if list(files) != [os.path.basename(fa)]: | |
891 |
|
|
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 |
|
|
884 | a = file(fa).read() | |
895 |
|
|
885 | if a != b: | |
896 |
|
|
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 |
|
|
898 | os.unlink(fa) | |
901 |
|
|
899 | os.unlink(fd) |
General Comments 0
You need to be logged in to leave comments.
Login now