mercurial/patch.py
changeset 4435 aac150af09e8
parent 4434 439b1c35348a
child 4436 a764edb6fc95
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -293,11 +293,13 @@ def patch(patchname, ui, strip=1, cwd=No
         """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))