Show More
@@ -880,11 +880,10 b' def debuginstall(ui):' | |||||
880 |
|
880 | |||
881 | # patch |
|
881 | # patch | |
882 | ui.status(_("Checking patch...\n")) |
|
882 | ui.status(_("Checking patch...\n")) | |
883 | path = os.environ.get('PATH', '') |
|
|||
884 | patcher = ui.config('ui', 'patch') |
|
883 | patcher = ui.config('ui', 'patch') | |
885 | if not patcher: |
|
884 | patcher = ((patcher and util.find_exe(patcher)) or | |
886 |
|
|
885 | util.find_exe('gpatch') or | |
887 |
|
|
886 | util.find_exe('patch')) | |
888 | if not patcher: |
|
887 | if not patcher: | |
889 | ui.write(_(" Can't find patch or gpatch in PATH\n")) |
|
888 | ui.write(_(" Can't find patch or gpatch in PATH\n")) | |
890 | ui.write(_(" (specify a patch utility in your .hgrc file)\n")) |
|
889 | ui.write(_(" (specify a patch utility in your .hgrc file)\n")) | |
@@ -922,9 +921,7 b' def debuginstall(ui):' | |||||
922 | ui.status(_("Checking merge helper...\n")) |
|
921 | ui.status(_("Checking merge helper...\n")) | |
923 | cmd = (os.environ.get("HGMERGE") or ui.config("ui", "merge") |
|
922 | cmd = (os.environ.get("HGMERGE") or ui.config("ui", "merge") | |
924 | or "hgmerge") |
|
923 | or "hgmerge") | |
925 | cmdpath = util.find_in_path(cmd, path) |
|
924 | cmdpath = util.find_exe(cmd) or util.find_exe(cmd.split()[0]) | |
926 | if not cmdpath: |
|
|||
927 | cmdpath = util.find_in_path(cmd.split()[0], path) |
|
|||
928 | if not cmdpath: |
|
925 | if not cmdpath: | |
929 | if cmd == 'hgmerge': |
|
926 | if cmd == 'hgmerge': | |
930 | ui.write(_(" No merge helper set and can't find default" |
|
927 | ui.write(_(" No merge helper set and can't find default" | |
@@ -958,9 +955,7 b' def debuginstall(ui):' | |||||
958 | editor = (os.environ.get("HGEDITOR") or |
|
955 | editor = (os.environ.get("HGEDITOR") or | |
959 | ui.config("ui", "editor") or |
|
956 | ui.config("ui", "editor") or | |
960 | os.environ.get("EDITOR", "vi")) |
|
957 | os.environ.get("EDITOR", "vi")) | |
961 |
cmdpath = util.find_ |
|
958 | cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0]) | |
962 | if not cmdpath: |
|
|||
963 | cmdpath = util.find_in_path(editor.split()[0], path) |
|
|||
964 | if not cmdpath: |
|
959 | if not cmdpath: | |
965 | if editor == 'vi': |
|
960 | if editor == 'vi': | |
966 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
|
961 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
@@ -295,11 +295,13 b' def patch(patchname, ui, strip=1, cwd=No' | |||||
295 |
|
295 | |||
296 | args = [] |
|
296 | args = [] | |
297 | patcher = ui.config('ui', 'patch') |
|
297 | patcher = ui.config('ui', 'patch') | |
|
298 | patcher = ((patcher and util.find_exe(patcher)) or | |||
|
299 | util.find_exe('gpatch') or | |||
|
300 | util.find_exe('patch')) | |||
298 | if not patcher: |
|
301 | if not patcher: | |
299 | patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), |
|
302 | raise util.Abort(_('no patch command found in hgrc or PATH')) | |
300 | 'patch') |
|
303 | if util.needbinarypatch(): | |
301 |
|
|
304 | args.append('--binary') | |
302 | args.append('--binary') |
|
|||
303 |
|
305 | |||
304 | if cwd: |
|
306 | if cwd: | |
305 | args.append('-d %s' % util.shellquote(cwd)) |
|
307 | args.append('-d %s' % util.shellquote(cwd)) | |
@@ -643,7 +645,7 b" def export(repo, revs, template='hg-%h.p" | |||||
643 | single(rev, seqno+1, fp) |
|
645 | single(rev, seqno+1, fp) | |
644 |
|
646 | |||
645 | def diffstat(patchlines): |
|
647 | def diffstat(patchlines): | |
646 |
if not util.find_ |
|
648 | if not util.find_exe('diffstat'): | |
647 | return |
|
649 | return | |
648 | fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt") |
|
650 | fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt") | |
649 | try: |
|
651 | try: |
@@ -1087,6 +1087,18 b' else:' | |||||
1087 | return p_name |
|
1087 | return p_name | |
1088 | return default |
|
1088 | return default | |
1089 |
|
1089 | |||
|
1090 | def find_exe(name, default=None): | |||
|
1091 | '''find path of an executable. | |||
|
1092 | if name contains a path component, return it as is. otherwise, | |||
|
1093 | use normal executable search path.''' | |||
|
1094 | ||||
|
1095 | if os.sep in name: | |||
|
1096 | # don't check the executable bit. if the file isn't | |||
|
1097 | # executable, whoever tries to actually run it will give a | |||
|
1098 | # much more useful error message. | |||
|
1099 | return name | |||
|
1100 | return find_in_path(name, os.environ.get('PATH', ''), default=default) | |||
|
1101 | ||||
1090 | def _buildencodefun(): |
|
1102 | def _buildencodefun(): | |
1091 | e = '_' |
|
1103 | e = '_' | |
1092 | win_reserved = [ord(x) for x in '\\:*?"<>|'] |
|
1104 | win_reserved = [ord(x) for x in '\\:*?"<>|'] |
General Comments 0
You need to be logged in to leave comments.
Login now