alias: e916ee90bfbd did not correctly handle whitespace in the args

This commit is contained in:
Benoit Boissinot 2009-05-19 14:14:07 +02:00
parent fc43ae9519
commit aa464dbde5
3 changed files with 10 additions and 4 deletions

View File

@ -11,7 +11,6 @@ mycmd = cmd --args
from mercurial.i18n import _ from mercurial.i18n import _
from mercurial import commands, cmdutil, error from mercurial import commands, cmdutil, error
import shlex
cmdtable = {} cmdtable = {}
@ -70,11 +69,12 @@ def uisetup(ui):
if not target: if not target:
ui.warn(_('*** [alias] %s: no definition\n') % cmd) ui.warn(_('*** [alias] %s: no definition\n') % cmd)
continue continue
args = shlex.split(target) args = target.split(' ', 1)
tcmd = args.pop(0) tcmd = args.pop(0)
if args: if args:
args = args[0]
defaults = ui.config('defaults', cmd) defaults = ui.config('defaults', cmd)
if defaults: if defaults:
args = shlex.split(defaults) + args args = ' '.join((args, defaults))
ui.setconfig('defaults', cmd, ' '.join(args)) ui.setconfig('defaults', cmd, args)
cmdtable[cmd] = lazycommand(ui, cmd, tcmd) cmdtable[cmd] = lazycommand(ui, cmd, tcmd)

View File

@ -12,6 +12,7 @@ ambiguous = s
recursive = recursive recursive = recursive
mylog = log mylog = log
lognull = log -r null lognull = log -r null
shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
[defaults] [defaults]
mylog = -q mylog = -q
@ -38,6 +39,9 @@ hg ci -Amfoo
echo '% with opts' echo '% with opts'
hg cleanst hg cleanst
echo '% with opts and whitespace'
hg shortlog
echo '% interaction with defaults' echo '% interaction with defaults'
hg mylog hg mylog
hg lognull hg lognull

View File

@ -8,6 +8,8 @@
adding foo adding foo
% with opts % with opts
C foo C foo
% with opts and whitespace
0 e63c23eaa88a | 1970-01-01 00:00 +0000
% interaction with defaults % interaction with defaults
0:e63c23eaa88a 0:e63c23eaa88a
-1:000000000000 -1:000000000000