Show More
@@ -2267,17 +2267,6 b' def _getaliasarg(tree):' | |||||
2267 | return tree[1] |
|
2267 | return tree[1] | |
2268 | return None |
|
2268 | return None | |
2269 |
|
2269 | |||
2270 | def _checkaliasarg(tree, known=None): |
|
|||
2271 | """Check tree contains no _aliasarg construct or only ones which |
|
|||
2272 | value is in known. Used to avoid alias placeholders injection. |
|
|||
2273 | """ |
|
|||
2274 | if isinstance(tree, tuple): |
|
|||
2275 | arg = _getaliasarg(tree) |
|
|||
2276 | if arg is not None and (not known or arg not in known): |
|
|||
2277 | raise error.UnknownIdentifier('_aliasarg', []) |
|
|||
2278 | for t in tree: |
|
|||
2279 | _checkaliasarg(t, known) |
|
|||
2280 |
|
||||
2281 | # the set of valid characters for the initial letter of symbols in |
|
2270 | # the set of valid characters for the initial letter of symbols in | |
2282 | # alias declarations and definitions |
|
2271 | # alias declarations and definitions | |
2283 | _aliassyminitletters = set(c for c in [chr(i) for i in xrange(256)] |
|
2272 | _aliassyminitletters = set(c for c in [chr(i) for i in xrange(256)] | |
@@ -2443,8 +2432,6 b' class revsetalias(object):' | |||||
2443 |
|
2432 | |||
2444 | try: |
|
2433 | try: | |
2445 | self.replacement = _parsealiasdefn(value, self.args) |
|
2434 | self.replacement = _parsealiasdefn(value, self.args) | |
2446 | # Check for placeholder injection |
|
|||
2447 | _checkaliasarg(self.replacement, self.args) |
|
|||
2448 | except error.ParseError as inst: |
|
2435 | except error.ParseError as inst: | |
2449 | self.error = _('failed to parse the definition of revset alias' |
|
2436 | self.error = _('failed to parse the definition of revset alias' | |
2450 | ' "%s": %s') % (self.name, parseerrordetail(inst)) |
|
2437 | ' "%s": %s') % (self.name, parseerrordetail(inst)) |
@@ -1820,6 +1820,15 b" but 'all()' should never be substituded " | |||||
1820 | <spanset+ 0:9>> |
|
1820 | <spanset+ 0:9>> | |
1821 | 0 |
|
1821 | 0 | |
1822 |
|
1822 | |||
|
1823 | test unknown reference: | |||
|
1824 | ||||
|
1825 | $ try "unknownref(0)" --config 'revsetalias.unknownref($1)=$1:$2' | |||
|
1826 | (func | |||
|
1827 | ('symbol', 'unknownref') | |||
|
1828 | ('symbol', '0')) | |||
|
1829 | abort: failed to parse the definition of revset alias "unknownref": '$' not for alias arguments | |||
|
1830 | [255] | |||
|
1831 | ||||
1823 | $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" |
|
1832 | $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" | |
1824 | ('symbol', 'tip') |
|
1833 | ('symbol', 'tip') | |
1825 | warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end |
|
1834 | warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end |
General Comments 0
You need to be logged in to leave comments.
Login now