Patchwork [3,of,3] debuginstall: strip double quotes from editorbin on Windows

login
register
mail settings
Submitter Matt Harbison
Date Feb. 21, 2018, 4:32 a.m.
Message ID <d78bc61eebd8f4a8e0e6.1519187574@Envy>
Download mbox | patch
Permalink /patch/28177/
State Accepted
Headers show

Comments

Matt Harbison - Feb. 21, 2018, 4:32 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1519182193 18000
#      Tue Feb 20 22:03:13 2018 -0500
# Node ID d78bc61eebd8f4a8e0e6aac21085308502fa3d9d
# Parent  8d7c512d216042abc6df7653ad6981275880ec45
debuginstall: strip double quotes from editorbin on Windows

The unconditional posix style shlex.split() prior to 94a1ff16f362 handled this.
This isn't mutually exclusive with stripping the quotes in util.findexe()- if
the editor can't be found, this command prints out the string, inside single
quotes.

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1241,6 +1241,8 @@ 
     editor = ui.geteditor()
     editor = util.expandpath(editor)
     editorbin = pycompat.shlexsplit(editor, posix=not pycompat.iswindows)[0]
+    if pycompat.iswindows and editorbin[0] == '"' and editorbin[-1] == '"':
+        editorbin = editorbin[1:-1]
     fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
     cmdpath = util.findexe(editorbin)
     fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',