Show More
@@ -1481,7 +1481,7 b' def _expandargs(tree, args):' | |||||
1481 | return args[arg] |
|
1481 | return args[arg] | |
1482 | return tuple(_expandargs(t, args) for t in tree) |
|
1482 | return tuple(_expandargs(t, args) for t in tree) | |
1483 |
|
1483 | |||
1484 | def _expandaliases(aliases, tree, expanding): |
|
1484 | def _expandaliases(aliases, tree, expanding, cache): | |
1485 | """Expand aliases in tree, recursively. |
|
1485 | """Expand aliases in tree, recursively. | |
1486 |
|
1486 | |||
1487 | 'aliases' is a dictionary mapping user defined aliases to |
|
1487 | 'aliases' is a dictionary mapping user defined aliases to | |
@@ -1496,17 +1496,20 b' def _expandaliases(aliases, tree, expand' | |||||
1496 | raise error.ParseError(_('infinite expansion of revset alias "%s" ' |
|
1496 | raise error.ParseError(_('infinite expansion of revset alias "%s" ' | |
1497 | 'detected') % alias.name) |
|
1497 | 'detected') % alias.name) | |
1498 | expanding.append(alias) |
|
1498 | expanding.append(alias) | |
1499 | result = _expandaliases(aliases, alias.replacement, expanding) |
|
1499 | if alias.name not in cache: | |
|
1500 | cache[alias.name] = _expandaliases(aliases, alias.replacement, | |||
|
1501 | expanding, cache) | |||
|
1502 | result = cache[alias.name] | |||
1500 | expanding.pop() |
|
1503 | expanding.pop() | |
1501 | if alias.args is not None: |
|
1504 | if alias.args is not None: | |
1502 | l = getlist(tree[2]) |
|
1505 | l = getlist(tree[2]) | |
1503 | if len(l) != len(alias.args): |
|
1506 | if len(l) != len(alias.args): | |
1504 | raise error.ParseError( |
|
1507 | raise error.ParseError( | |
1505 | _('invalid number of arguments: %s') % len(l)) |
|
1508 | _('invalid number of arguments: %s') % len(l)) | |
1506 | l = [_expandaliases(aliases, a, []) for a in l] |
|
1509 | l = [_expandaliases(aliases, a, [], cache) for a in l] | |
1507 | result = _expandargs(result, dict(zip(alias.args, l))) |
|
1510 | result = _expandargs(result, dict(zip(alias.args, l))) | |
1508 | else: |
|
1511 | else: | |
1509 | result = tuple(_expandaliases(aliases, t, expanding) |
|
1512 | result = tuple(_expandaliases(aliases, t, expanding, cache) | |
1510 | for t in tree) |
|
1513 | for t in tree) | |
1511 | return result |
|
1514 | return result | |
1512 |
|
1515 | |||
@@ -1516,7 +1519,7 b' def findaliases(ui, tree):' | |||||
1516 | for k, v in ui.configitems('revsetalias'): |
|
1519 | for k, v in ui.configitems('revsetalias'): | |
1517 | alias = revsetalias(k, v) |
|
1520 | alias = revsetalias(k, v) | |
1518 | aliases[alias.name] = alias |
|
1521 | aliases[alias.name] = alias | |
1519 | return _expandaliases(aliases, tree, []) |
|
1522 | return _expandaliases(aliases, tree, [], {}) | |
1520 |
|
1523 | |||
1521 | parse = parser.parser(tokenize, elements).parse |
|
1524 | parse = parser.parser(tokenize, elements).parse | |
1522 |
|
1525 |
General Comments 0
You need to be logged in to leave comments.
Login now