# HG changeset patch # User Patrick Mezard # Date 1178996971 -7200 # Node ID aac150af09e8f8cf39cdfdcc1ae081e419f98b09 # Parent 439b1c35348a5dc95cfc44ed7f5d7aae543ebcf2 Add ui.patch option. ui.patch overrides the default patch/gpatch command and options. diff -r 439b1c35348a -r aac150af09e8 doc/hgrc.5.txt --- a/doc/hgrc.5.txt Sat May 12 21:09:29 2007 +0200 +++ b/doc/hgrc.5.txt Sat May 12 21:09:31 2007 +0200 @@ -432,6 +432,9 @@ merge;; The conflict resolution program to use during a manual merge. Default is "hgmerge". + patch;; + command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if + unset. quiet;; Reduce the amount of output printed. True or False. Default is False. remotecmd;; diff -r 439b1c35348a -r aac150af09e8 mercurial/commands.py --- a/mercurial/commands.py Sat May 12 21:09:29 2007 +0200 +++ b/mercurial/commands.py Sat May 12 21:09:31 2007 +0200 @@ -881,8 +881,10 @@ # patch ui.status(_("Checking patch...\n")) path = os.environ.get('PATH', '') - patcher = util.find_in_path('gpatch', path, - util.find_in_path('patch', path, None)) + patcher = ui.config('ui', 'patch') + if not patcher: + patcher = util.find_in_path('gpatch', path, + util.find_in_path('patch', path, None)) if not patcher: ui.write(_(" Can't find patch or gpatch in PATH\n")) ui.write(_(" (specify a patch utility in your .hgrc file)\n")) diff -r 439b1c35348a -r aac150af09e8 mercurial/patch.py --- a/mercurial/patch.py Sat May 12 21:09:29 2007 +0200 +++ b/mercurial/patch.py Sat May 12 21:09:31 2007 +0200 @@ -293,11 +293,13 @@ """patch and updates the files and fuzz variables""" fuzz = False - patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), - 'patch') args = [] - if util.needbinarypatch(): - args.append('--binary') + patcher = ui.config('ui', 'patch') + if not patcher: + patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), + 'patch') + if util.needbinarypatch(): + args.append('--binary') if cwd: args.append('-d %s' % util.shellquote(cwd))