Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 28690:b56bf98c8afb
revset: drop redundant check for unknown alias arguments
Since _parsealiasdefn() rejects unknown alias arguments, _checkaliasarg() is
unnecessary. New test is added to make sure unknown '$n' symbols are rejected.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 14 Feb 2016 20:27:08 +0900 |
parents | a14732e08fec |
children | a04baf9c063b |
line wrap: on
line diff
--- a/mercurial/revset.py Sun Feb 14 19:48:33 2016 +0900 +++ b/mercurial/revset.py Sun Feb 14 20:27:08 2016 +0900 @@ -2267,17 +2267,6 @@ return tree[1] return None -def _checkaliasarg(tree, known=None): - """Check tree contains no _aliasarg construct or only ones which - value is in known. Used to avoid alias placeholders injection. - """ - if isinstance(tree, tuple): - arg = _getaliasarg(tree) - if arg is not None and (not known or arg not in known): - raise error.UnknownIdentifier('_aliasarg', []) - for t in tree: - _checkaliasarg(t, known) - # the set of valid characters for the initial letter of symbols in # alias declarations and definitions _aliassyminitletters = set(c for c in [chr(i) for i in xrange(256)] @@ -2443,8 +2432,6 @@ try: self.replacement = _parsealiasdefn(value, self.args) - # Check for placeholder injection - _checkaliasarg(self.replacement, self.args) except error.ParseError as inst: self.error = _('failed to parse the definition of revset alias' ' "%s": %s') % (self.name, parseerrordetail(inst))