Show More
@@ -1240,9 +1240,7 b' def debuginstall(ui, **opts):' | |||
|
1240 | 1240 | # editor |
|
1241 | 1241 | editor = ui.geteditor() |
|
1242 | 1242 | editor = util.expandpath(editor) |
|
1243 |
editorbin = |
|
|
1244 | if pycompat.iswindows and editorbin[0] == '"' and editorbin[-1] == '"': | |
|
1245 | editorbin = editorbin[1:-1] | |
|
1243 | editorbin = util.shellsplit(editor)[0] | |
|
1246 | 1244 | fm.write('editor', _("checking commit editor... (%s)\n"), editorbin) |
|
1247 | 1245 | cmdpath = util.findexe(editorbin) |
|
1248 | 1246 | fm.condwrite(not cmdpath and editor == 'vi', 'vinotfound', |
@@ -461,6 +461,10 b' def shellquote(s):' | |||
|
461 | 461 | else: |
|
462 | 462 | return "'%s'" % s.replace("'", "'\\''") |
|
463 | 463 | |
|
464 | def shellsplit(s): | |
|
465 | """Parse a command string in POSIX shell way (best-effort)""" | |
|
466 | return pycompat.shlexsplit(s, posix=True) | |
|
467 | ||
|
464 | 468 | def quotecommand(cmd): |
|
465 | 469 | return cmd |
|
466 | 470 |
@@ -147,6 +147,7 b' setbinary = platform.setbinary' | |||
|
147 | 147 | setflags = platform.setflags |
|
148 | 148 | setsignalhandler = platform.setsignalhandler |
|
149 | 149 | shellquote = platform.shellquote |
|
150 | shellsplit = platform.shellsplit | |
|
150 | 151 | spawndetached = platform.spawndetached |
|
151 | 152 | split = platform.split |
|
152 | 153 | sshargs = platform.sshargs |
@@ -296,6 +296,15 b' def shellquote(s):' | |||
|
296 | 296 | return s |
|
297 | 297 | return '"%s"' % _quotere.sub(r'\1\1\\\2', s) |
|
298 | 298 | |
|
299 | def _unquote(s): | |
|
300 | if s.startswith(b'"') and s.endswith(b'"'): | |
|
301 | return s[1:-1] | |
|
302 | return s | |
|
303 | ||
|
304 | def shellsplit(s): | |
|
305 | """Parse a command string in cmd.exe way (best-effort)""" | |
|
306 | return pycompat.maplist(_unquote, pycompat.shlexsplit(s, posix=False)) | |
|
307 | ||
|
299 | 308 | def quotecommand(cmd): |
|
300 | 309 | """Build a command string suitable for os.popen* calls.""" |
|
301 | 310 | if sys.version_info < (2, 7, 1): |
General Comments 0
You need to be logged in to leave comments.
Login now