Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 36273:564dec70b50c
debugcommands: print out the editor that was searched for (post shlexsplit)
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.
Differential Revision: https://phab.mercurial-scm.org/D1808
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 04 Jan 2018 16:29:07 -0800 |
parents | 72d155a792b1 |
children | 94a1ff16f362 |
comparison
equal
deleted
inserted
replaced
36272:d879aab17786 | 36273:564dec70b50c |
---|---|
1238 _(" (templates seem to have been installed incorrectly)\n")) | 1238 _(" (templates seem to have been installed incorrectly)\n")) |
1239 | 1239 |
1240 # editor | 1240 # editor |
1241 editor = ui.geteditor() | 1241 editor = ui.geteditor() |
1242 editor = util.expandpath(editor) | 1242 editor = util.expandpath(editor) |
1243 fm.write('editor', _("checking commit editor... (%s)\n"), editor) | 1243 editorbin = pycompat.shlexsplit(editor)[0] |
1244 cmdpath = util.findexe(pycompat.shlexsplit(editor)[0]) | 1244 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin) |
1245 cmdpath = util.findexe(editorbin) | |
1245 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', | 1246 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', |
1246 _(" No commit editor set and can't find %s in PATH\n" | 1247 _(" No commit editor set and can't find %s in PATH\n" |
1247 " (specify a commit editor in your configuration" | 1248 " (specify a commit editor in your configuration" |
1248 " file)\n"), not cmdpath and editor == 'vi' and editor) | 1249 " file)\n"), not cmdpath and editor == 'vi' and editorbin) |
1249 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound', | 1250 fm.condwrite(not cmdpath and editor != 'vi', 'editornotfound', |
1250 _(" Can't find editor '%s' in PATH\n" | 1251 _(" Can't find editor '%s' in PATH\n" |
1251 " (specify a commit editor in your configuration" | 1252 " (specify a commit editor in your configuration" |
1252 " file)\n"), not cmdpath and editor) | 1253 " file)\n"), not cmdpath and editorbin) |
1253 if not cmdpath and editor != 'vi': | 1254 if not cmdpath and editor != 'vi': |
1254 problems += 1 | 1255 problems += 1 |
1255 | 1256 |
1256 # check username | 1257 # check username |
1257 username = None | 1258 username = None |