Show More
@@ -527,21 +527,29 b' invalid global arguments for normal comm' | |||||
527 |
|
527 | |||
528 | environment variable changes in alias commands |
|
528 | environment variable changes in alias commands | |
529 |
|
529 | |||
530 |
$ cat > $TESTTMP/ |
|
530 | $ cat > $TESTTMP/expandalias.py <<EOF | |
531 | > import os |
|
531 | > import os | |
532 | > def uisetup(ui): |
|
532 | > from mercurial import cmdutil, commands, registrar | |
|
533 | > cmdtable = {} | |||
|
534 | > command = registrar.command(cmdtable) | |||
|
535 | > @command('expandalias') | |||
|
536 | > def expandalias(ui, repo, name): | |||
|
537 | > alias = cmdutil.findcmd(name, commands.table)[1][0] | |||
|
538 | > ui.write('%s args: %s\n' % (name, ' '.join(alias.args))) | |||
533 | > os.environ['COUNT'] = '2' |
|
539 | > os.environ['COUNT'] = '2' | |
|
540 | > ui.write('%s args: %s (with COUNT=2)\n' % (name, ' '.join(alias.args))) | |||
534 | > EOF |
|
541 | > EOF | |
535 |
|
542 | |||
536 | $ cat >> $HGRCPATH <<'EOF' |
|
543 | $ cat >> $HGRCPATH <<'EOF' | |
537 | > [extensions] |
|
544 | > [extensions] | |
538 | > setcount = $TESTTMP/setcount.py |
|
545 | > expandalias = $TESTTMP/expandalias.py | |
539 | > [alias] |
|
546 | > [alias] | |
540 |
> showcount = log -T "$COUNT |
|
547 | > showcount = log -T "$COUNT" -r . | |
541 | > EOF |
|
548 | > EOF | |
542 |
|
549 | |||
543 | $ COUNT=1 hg showcount |
|
550 | $ COUNT=1 hg expandalias showcount | |
544 | 2 |
|
551 | showcount args: -T 1 -r . | |
|
552 | showcount args: -T 2 -r . (with COUNT=2) | |||
545 |
|
553 | |||
546 | This should show id: |
|
554 | This should show id: | |
547 |
|
555 |
General Comments 0
You need to be logged in to leave comments.
Login now