changeset 16242:55174ab81973 stable

extdiff: escape filenames with vim/DirDiff and make quoting work with Windows Use vim function fnameescape() on filenames. Use double quotes for arguments so cmd.exe is happy.
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 12 Mar 2012 09:39:30 +0100
parents ce292f1379ba
children b9c4302310e5
files contrib/win32/mercurial.ini hgext/extdiff.py tests/test-extension.t
diffstat 3 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/win32/mercurial.ini	Thu Mar 08 13:35:27 2012 -0600
+++ b/contrib/win32/mercurial.ini	Mon Mar 12 09:39:30 2012 +0100
@@ -71,7 +71,7 @@
 ;cmd.bc3diff = C:\Program Files\Beyond Compare 3\BCompare.exe
 ;cmd.vdiff = C:\Progra~1\TortoiseSVN\bin\TortoiseMerge.exe
 ;cmd.vimdiff = gvim.exe
-;opts.vimdiff = -f '+next' '+execute "DirDiff ".argv(0)." ".argv(1)'
+;opts.vimdiff = -f "+next" "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
 
 
 [hgk]
--- a/hgext/extdiff.py	Thu Mar 08 13:35:27 2012 -0600
+++ b/hgext/extdiff.py	Mon Mar 12 09:39:30 2012 +0100
@@ -33,7 +33,8 @@
   # (see http://www.vim.org/scripts/script.php?script_id=102) Non
   # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
   # your .vimrc
-  vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)'
+  vimdiff = gvim -f "+next" \\
+            "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
 
 Tool arguments can include variables that are expanded at runtime::
 
--- a/tests/test-extension.t	Thu Mar 08 13:35:27 2012 -0600
+++ b/tests/test-extension.t	Mon Mar 12 09:39:30 2012 +0100
@@ -301,7 +301,8 @@
     # (see http://www.vim.org/scripts/script.php?script_id=102) Non
     # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
     # your .vimrc
-    vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)'
+    vimdiff = gvim -f "+next" \
+              "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
   
   Tool arguments can include variables that are expanded at runtime: