mercurial/revsetlang.py
changeset 35560 3a8810c1b9bc
parent 35559 a480551bd1b4
child 35561 4c3a4bb31c0e
--- a/mercurial/revsetlang.py	Sat Apr 01 16:56:47 2017 +0900
+++ b/mercurial/revsetlang.py	Sat Apr 01 17:04:49 2017 +0900
@@ -620,9 +620,9 @@
         return '(%s or %s)' % (listexp(s[:m], t), listexp(s[m:], t))
 
     expr = pycompat.bytestr(expr)
+    argiter = iter(args)
     ret = []
     pos = 0
-    arg = 0
     while pos < len(expr):
         q = expr.find('%', pos)
         if q < 0:
@@ -634,14 +634,12 @@
         if d == '%':
             ret.append(d)
         elif d in 'dsnbr':
-            ret.append(argtype(d, args[arg]))
-            arg += 1
+            ret.append(argtype(d, next(argiter)))
         elif d == 'l':
             # a list of some type
             pos += 1
             d = expr[pos]
-            ret.append(listexp(list(args[arg]), d))
-            arg += 1
+            ret.append(listexp(list(next(argiter)), d))
         else:
             raise error.Abort(_('unexpected revspec format character %s') % d)
         pos += 1