[PATCH] debuginstall: do not parse editor command in posix way on Windows

Yuya Nishihara yuya at tcha.org
Fri Feb 16 23:33:38 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1518840784 -32400
#      Sat Feb 17 13:13:04 2018 +0900
# Node ID b42f9a63030fee00568add7aa5a5ff983fbcd06d
# Parent  c9f30dcc3f43793088c99c3acef7db12857cc2cc
debuginstall: do not parse editor command in posix way on Windows

An editor command is executed by a system shell, which is cmd.exe on Windows.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1240,7 +1240,7 @@ def debuginstall(ui, **opts):
     # editor
     editor = ui.geteditor()
     editor = util.expandpath(editor)
-    editorbin = pycompat.shlexsplit(editor)[0]
+    editorbin = pycompat.shlexsplit(editor, posix=not pycompat.iswindows)[0]
     fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
     cmdpath = util.findexe(editorbin)
     fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -140,8 +140,10 @@ not found (this is intentionally using b
   checking "re2" regexp engine \((available|missing)\) (re)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
-  checking commit editor... (c:foobarbaz.exe)
-   Can't find editor 'c:foobarbaz.exe' in PATH
+  checking commit editor... (c:\foo\bar\baz.exe) (windows !)
+   Can't find editor 'c:\foo\bar\baz.exe' in PATH (windows !)
+  checking commit editor... (c:foobarbaz.exe) (no-windows !)
+   Can't find editor 'c:foobarbaz.exe' in PATH (no-windows !)
    (specify a commit editor in your configuration file)
   checking username (test)
   1 problems detected, please check your install!


More information about the Mercurial-devel mailing list