[PATCH 1 of 2] patch: fix ui.patch regression introduced by 62019c4427e3

Patrick Mezard pmezard at gmail.com
Tue Jun 19 10:44:42 CDT 2007


# HG changeset patch
# User Patrick Mezard <pmezard at gmail.com>
# Date 1182265327 -7200
# Node ID 52322ecd604f0829cb78cb45b6c20492f0707cf9
# Parent  63b9d2deed48a80549bce637517ef9d4ac3f4873
patch: fix ui.patch regression introduced by 62019c4427e3.

The idea is ui.patch is either empty or wisely filled by user.

diff -r 63b9d2deed48 -r 52322ecd604f mercurial/patch.py
--- a/mercurial/patch.py	Tue Jun 19 08:51:34 2007 +0200
+++ b/mercurial/patch.py	Tue Jun 19 17:02:07 2007 +0200
@@ -298,13 +298,14 @@ def patch(patchname, ui, strip=1, cwd=No
 
         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))


More information about the Mercurial-devel mailing list