[PATCH 3 of 5] revsetlang: unnest "if True" in formatrevspec()
Yuya Nishihara
yuya at tcha.org
Sun Jan 7 01:31:53 EST 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1491033407 -32400
# Sat Apr 01 16:56:47 2017 +0900
# Node ID 11003d3f4751eb00f04c43bbeed25fe044a3db87
# Parent cac1c609a310d403b4d1acefac35aa86d871b608
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)
More information about the Mercurial-devel
mailing list