Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revsetlang.py @ 35591:8f1a7adb3225
revsetlang: catch invalid format character with %l prefix
listexp() could call argtype() with an invalid format character, but that
wasn't checked before.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 01 Apr 2017 17:18:31 +0900 |
parents | 4c3a4bb31c0e |
children | 0fd617afebc0 |
line wrap: on
line diff
--- a/mercurial/revsetlang.py Fri Dec 29 06:32:17 2017 +0530 +++ b/mercurial/revsetlang.py Sat Apr 01 17:18:31 2017 +0900 @@ -600,6 +600,7 @@ return _quote(node.hex(arg)) elif c == 'b': return _quote(arg.branch()) + raise error.ParseError(_('unexpected revspec format character %s') % c) def listexp(s, t): l = len(s) @@ -633,16 +634,13 @@ d = expr[pos] if d == '%': ret.append(d) - elif d in 'dsnbr': - ret.append(argtype(d, next(argiter))) elif d == 'l': # a list of some type pos += 1 d = expr[pos] ret.append(listexp(list(next(argiter)), d)) else: - raise error.ParseError(_('unexpected revspec format character %s') - % d) + ret.append(argtype(d, next(argiter))) pos += 1 return ''.join(ret)