D1808: debugcommands: print out the editor that was searched for (post shlexsplit)

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Fri Jan 5 00:04:45 UTC 2018


spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  A user was in #mercurial and had the following settings in their hgrc:
  
    [ui]
    editor = C:\home\npp\notepad++.exe -multiInst -nosession
  
  After shlexsplit, the first argument was mangled into C:homenppnotepad++.exe,
  which was quite unlikely to exist.  It took many back-and-forths to identify
  that adding " characters around the exe would fix the issue; we were thinking
  that it's because something was incorrectly *not* splitting and adding/moving
  the " characters fixed the split boundaries, but when testing afterward it
  appears that it's just mangled.
  
  I considered adding an informational if pycompat.iswindows and \ in the string
  about this issue, but was worried that might have too many false positives and
  did not do so at this time.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1808

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1209,15 +1209,16 @@
     editor = ui.geteditor()
     editor = util.expandpath(editor)
     fm.write('editor', _("checking commit editor... (%s)\n"), editor)
-    cmdpath = util.findexe(pycompat.shlexsplit(editor)[0])
+    editorbin = pycompat.shlexsplit(editor)[0]
+    cmdpath = util.findexe(editorbin)
     fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
                  _(" No commit editor set and can't find %s in PATH\n"
                    " (specify a commit editor in your configuration"
-                   " file)\n"), not cmdpath and editor == 'vi' and editor)
+                   " file)\n"), editorbin)
     fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound',
                  _(" Can't find editor '%s' in PATH\n"
                    " (specify a commit editor in your configuration"
-                   " file)\n"), not cmdpath and editor)
+                   " file)\n"), editorbin)
     if not cmdpath and editor != 'vi':
         problems += 1
 



To: spectral, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list