comparison 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
comparison
equal deleted inserted replaced
8631:a87c41f65aff 8632:9e055cfdd620
219 want_sha1 = [] 219 want_sha1 = []
220 count = 0 220 count = 0
221 221
222 # figure out which commits they are asking for and which ones they 222 # figure out which commits they are asking for and which ones they
223 # want us to stop on 223 # want us to stop on
224 for i in xrange(len(args)): 224 for i, arg in enumerate(args):
225 if args[i].startswith('^'): 225 if arg.startswith('^'):
226 s = repo.lookup(args[i][1:]) 226 s = repo.lookup(arg[1:])
227 stop_sha1.append(s) 227 stop_sha1.append(s)
228 want_sha1.append(s) 228 want_sha1.append(s)
229 elif args[i] != 'HEAD': 229 elif arg != 'HEAD':
230 want_sha1.append(repo.lookup(args[i])) 230 want_sha1.append(repo.lookup(arg))
231 231
232 # calculate the graph for the supplied commits 232 # calculate the graph for the supplied commits
233 for i in xrange(len(want_sha1)): 233 for i, n in enumerate(want_sha1):
234 reachable.append(set()); 234 reachable.append(set());
235 n = want_sha1[i];
236 visit = [n]; 235 visit = [n];
237 reachable[i].add(n) 236 reachable[i].add(n)
238 while visit: 237 while visit:
239 n = visit.pop(0) 238 n = visit.pop(0)
240 if n in stop_sha1: 239 if n in stop_sha1: