comparison mercurial/debugcommands.py @ 36415:0cb09c322647

util: factor out shellsplit() function It turned out to be more than the simple posix=True|False flag, so let's introduce a platform function. I also made it py3 ready.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 21 Feb 2018 22:20:27 +0900
parents a24c57f1f5c3
children 580f75f70f39
comparison
equal deleted inserted replaced
36414:44c4a38bf563 36415:0cb09c322647
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 editorbin = pycompat.shlexsplit(editor, posix=not pycompat.iswindows)[0] 1243 editorbin = util.shellsplit(editor)[0]
1244 if pycompat.iswindows and editorbin[0] == '"' and editorbin[-1] == '"':
1245 editorbin = editorbin[1:-1]
1246 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin) 1244 fm.write('editor', _("checking commit editor... (%s)\n"), editorbin)
1247 cmdpath = util.findexe(editorbin) 1245 cmdpath = util.findexe(editorbin)
1248 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', 1246 fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound',
1249 _(" 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"
1250 " (specify a commit editor in your configuration" 1248 " (specify a commit editor in your configuration"