diff hgext/hgk.py @ 8632:9e055cfdd620

replace "i in range(len(xs))" with "i, x in enumerate(xs)" The remaining occurrences should be the ones where "xs" is mutated or where "i" is used for index arithmetic.
author Martin Geisler <mg@lazybytes.net>
date Tue, 26 May 2009 22:59:52 +0200
parents 2b3dec0ef3ae
children bf17aeafb869
line wrap: on
line diff
--- a/hgext/hgk.py	Tue May 26 22:37:26 2009 +0200
+++ b/hgext/hgk.py	Tue May 26 22:59:52 2009 +0200
@@ -221,18 +221,17 @@
 
     # figure out which commits they are asking for and which ones they
     # want us to stop on
-    for i in xrange(len(args)):
-        if args[i].startswith('^'):
-            s = repo.lookup(args[i][1:])
+    for i, arg in enumerate(args):
+        if arg.startswith('^'):
+            s = repo.lookup(arg[1:])
             stop_sha1.append(s)
             want_sha1.append(s)
-        elif args[i] != 'HEAD':
-            want_sha1.append(repo.lookup(args[i]))
+        elif arg != 'HEAD':
+            want_sha1.append(repo.lookup(arg))
 
     # calculate the graph for the supplied commits
-    for i in xrange(len(want_sha1)):
+    for i, n in enumerate(want_sha1):
         reachable.append(set());
-        n = want_sha1[i];
         visit = [n];
         reachable[i].add(n)
         while visit: