Show More
@@ -1377,16 +1377,15 b' def _expandaliases(aliases, tree, expand' | |||||
1377 | raise error.ParseError(_('infinite expansion of revset alias "%s" ' |
|
1377 | raise error.ParseError(_('infinite expansion of revset alias "%s" ' | |
1378 | 'detected') % alias.name) |
|
1378 | 'detected') % alias.name) | |
1379 | expanding.append(alias) |
|
1379 | expanding.append(alias) | |
1380 | result = alias.replacement |
|
1380 | result = _expandaliases(aliases, alias.replacement, expanding) | |
|
1381 | expanding.pop() | |||
1381 | if alias.args is not None: |
|
1382 | if alias.args is not None: | |
1382 | l = getlist(tree[2]) |
|
1383 | l = getlist(tree[2]) | |
1383 | if len(l) != len(alias.args): |
|
1384 | if len(l) != len(alias.args): | |
1384 | raise error.ParseError( |
|
1385 | raise error.ParseError( | |
1385 | _('invalid number of arguments: %s') % len(l)) |
|
1386 | _('invalid number of arguments: %s') % len(l)) | |
|
1387 | l = [_expandaliases(aliases, a, []) for a in l] | |||
1386 | result = _expandargs(result, dict(zip(alias.args, l))) |
|
1388 | result = _expandargs(result, dict(zip(alias.args, l))) | |
1387 | # Recurse in place, the base expression may have been rewritten |
|
|||
1388 | result = _expandaliases(aliases, result, expanding) |
|
|||
1389 | expanding.pop() |
|
|||
1390 | else: |
|
1389 | else: | |
1391 | result = tuple(_expandaliases(aliases, t, expanding) |
|
1390 | result = tuple(_expandaliases(aliases, t, expanding) | |
1392 | for t in tree) |
|
1391 | for t in tree) |
@@ -520,6 +520,27 b' test infinite recursion' | |||||
520 | hg: parse error: infinite expansion of revset alias "recurse1" detected |
|
520 | hg: parse error: infinite expansion of revset alias "recurse1" detected | |
521 | [255] |
|
521 | [255] | |
522 |
|
522 | |||
|
523 | $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc | |||
|
524 | $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc | |||
|
525 | $ try "level2(level1(1, 2), 3)" | |||
|
526 | (func | |||
|
527 | ('symbol', 'level2') | |||
|
528 | (list | |||
|
529 | (func | |||
|
530 | ('symbol', 'level1') | |||
|
531 | (list | |||
|
532 | ('symbol', '1') | |||
|
533 | ('symbol', '2'))) | |||
|
534 | ('symbol', '3'))) | |||
|
535 | (or | |||
|
536 | ('symbol', '3') | |||
|
537 | (or | |||
|
538 | ('symbol', '1') | |||
|
539 | ('symbol', '2'))) | |||
|
540 | 3 | |||
|
541 | 1 | |||
|
542 | 2 | |||
|
543 | ||||
523 | test nesting and variable passing |
|
544 | test nesting and variable passing | |
524 |
|
545 | |||
525 | $ echo 'nested($1) = nested2($1)' >> .hg/hgrc |
|
546 | $ echo 'nested($1) = nested2($1)' >> .hg/hgrc |
General Comments 0
You need to be logged in to leave comments.
Login now