revsetlang: unnest "if True" in formatrevspec()
authorYuya Nishihara <yuya@tcha.org>
Sat, 01 Apr 2017 16:56:47 +0900
changeset 35559 a480551bd1b4
parent 35558 dfc628611144
child 35560 3a8810c1b9bc
revsetlang: unnest "if True" in formatrevspec()
mercurial/revsetlang.py
--- a/mercurial/revsetlang.py	Sat Apr 01 16:55:28 2017 +0900
+++ b/mercurial/revsetlang.py	Sat Apr 01 16:56:47 2017 +0900
@@ -630,22 +630,20 @@
             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)