changeset 4644:50252ea60549

patch: fix ui.patch regression introduced by 62019c4427e3. The idea is ui.patch is either empty or wisely filled by user.
author Patrick Mezard <pmezard@gmail.com>
date Tue, 19 Jun 2007 17:02:07 +0200
parents a39cec1d5cb8
children 0de7e6e27fe4
files mercurial/patch.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Wed Jun 20 22:06:37 2007 +0200
+++ b/mercurial/patch.py	Tue Jun 19 17:02:07 2007 +0200
@@ -298,13 +298,14 @@
 
         args = []
         patcher = ui.config('ui', 'patch')
-        patcher = ((patcher and util.find_exe(patcher)) or
-                   util.find_exe('gpatch') or
-                   util.find_exe('patch'))
+        if not patcher:
+            patcher = util.find_exe('gpatch') or util.find_exe('patch')
+            # Try to be smart only if patch call was not supplied
+            if util.needbinarypatch():
+                args.append('--binary')
+                
         if not patcher:
             raise util.Abort(_('no patch command found in hgrc or PATH'))
-        if util.needbinarypatch():
-            args.append('--binary')
 
         if cwd:
             args.append('-d %s' % util.shellquote(cwd))