changeset 4434:439b1c35348a

Fix issue483 - mq does not work under windows with gnu-win32 patch. Add --binary option to patch command under win32.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 12 May 2007 21:09:29 +0200
parents ba22e867cb23
children aac150af09e8
files mercurial/patch.py mercurial/util.py
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Mon May 07 21:44:11 2007 +0900
+++ b/mercurial/patch.py	Sat May 12 21:09:29 2007 +0200
@@ -296,6 +296,9 @@
         patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''),
                                     'patch')
         args = []
+        if util.needbinarypatch():
+            args.append('--binary')
+                                    
         if cwd:
             args.append('-d %s' % util.shellquote(cwd))
         fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
--- a/mercurial/util.py	Mon May 07 21:44:11 2007 +0900
+++ b/mercurial/util.py	Sat May 12 21:09:29 2007 +0200
@@ -793,6 +793,10 @@
 _umask = os.umask(0)
 os.umask(_umask)
 
+def needbinarypatch():
+    """return True if patches should be applied in binary mode by default."""
+    return os.name == 'nt'
+
 # Platform specific variants
 if os.name == 'nt':
     import msvcrt