changeset 35559:a480551bd1b4

revsetlang: unnest "if True" in formatrevspec()
author Yuya Nishihara <yuya@tcha.org>
date Sat, 01 Apr 2017 16:56:47 +0900
parents dfc628611144
children 3a8810c1b9bc
files mercurial/revsetlang.py
diffstat 1 files changed, 13 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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)