Patchwork [STABLE] debuginstall: expand the editor path before searching for it (issue4380)

login
register
mail settings
Submitter Matt Harbison
Date May 1, 2015, 3:09 a.m.
Message ID <d1dcdb69a2ca84954d0a.1430449755@Envy>
Download mbox | patch
Permalink /patch/8823/
State Accepted
Headers show

Comments

Matt Harbison - May 1, 2015, 3:09 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1430449372 14400
#      Thu Apr 30 23:02:52 2015 -0400
# Branch stable
# Node ID d1dcdb69a2ca84954d0a5b32d9b8d8e1652de5a8
# Parent  ab9390165429b7891364c0d454f3ae3b04b00c7d
debuginstall: expand the editor path before searching for it (issue4380)

The editor launches without expanding the path with commits because the shell
does that for us.

If the path isn't an executable, the expanded path is displayed, which is
probably more useful than the unexpanded path.  For example, in cmd.exe, '~'
expands to C:\Users\$user.  But it expands to C:/mingw/msys/1.0/home/$user in
MinGW.
Matt Mackall - May 1, 2015, 7:46 p.m.
On Thu, 2015-04-30 at 23:09 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1430449372 14400
> #      Thu Apr 30 23:02:52 2015 -0400
> # Branch stable
> # Node ID d1dcdb69a2ca84954d0a5b32d9b8d8e1652de5a8
> # Parent  ab9390165429b7891364c0d454f3ae3b04b00c7d
> debuginstall: expand the editor path before searching for it (issue4380)

Queued for stable, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2370,6 +2370,7 @@ 
     # editor
     ui.status(_("checking commit editor...\n"))
     editor = ui.geteditor()
+    editor = util.expandpath(editor)
     cmdpath = util.findexe(shlex.split(editor)[0])
     if not cmdpath:
         if editor == 'vi':
diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -24,3 +24,20 @@ 
    (specify a username in your configuration file)
   1 problems detected, please check your install!
   [1]
+
+path variables are expanded (~ is the same as $TESTTMP)
+  $ mkdir tools
+  $ touch tools/testeditor.exe
+#if execbit
+  $ chmod 755 tools/testeditor.exe
+#endif
+  $ hg debuginstall --config ui.editor=~/tools/testeditor.exe
+  checking encoding (ascii)...
+  checking Python executable (*) (glob)
+  checking Python version (*) (glob)
+  checking Python lib (*lib*)... (glob)
+  checking installed modules (*mercurial)... (glob)
+  checking templates (*mercurial?templates)... (glob)
+  checking commit editor...
+  checking username...
+  no problems detected