Patchwork debuginstall: do not parse editor command in posix way on Windows

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 17, 2018, 4:33 a.m.
Message ID <b42f9a63030fee00568a.1518842018@mimosa>
Download mbox | patch
Permalink /patch/28006/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 17, 2018, 4:33 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Augie Fackler - Feb. 18, 2018, 9:05 p.m.
On Sat, Feb 17, 2018 at 01:33:38PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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

queued, thanks

Patch

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!