# HG changeset patch # User Yuya Nishihara # Date 2017-04-01 07:56:47 # Node ID a480551bd1b4af9f3c6d142bc7901e16306308e8 # Parent dfc6286111441753103db8684697af2176d43c4d revsetlang: unnest "if True" in formatrevspec() diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -630,22 +630,20 @@ def formatspec(expr, *args): break ret.append(expr[pos:q]) pos = q + 1 - if True: + d = expr[pos] + if d == '%': + ret.append(d) + elif d in 'dsnbr': + ret.append(argtype(d, args[arg])) + arg += 1 + elif d == 'l': + # a list of some type + pos += 1 d = expr[pos] - if d == '%': - ret.append(d) - elif d in 'dsnbr': - ret.append(argtype(d, args[arg])) - arg += 1 - elif d == 'l': - # a list of some type - pos += 1 - d = expr[pos] - ret.append(listexp(list(args[arg]), d)) - arg += 1 - else: - raise error.Abort(_('unexpected revspec format character %s') - % d) + ret.append(listexp(list(args[arg]), d)) + arg += 1 + else: + raise error.Abort(_('unexpected revspec format character %s') % d) pos += 1 return ''.join(ret)