##// END OF EJS Templates
replace "i in range(len(xs))" with "i, x in enumerate(xs)"...
Martin Geisler -
r8632:9e055cfd default
parent child Browse files
Show More
@@ -221,18 +221,17 b' def revtree(ui, args, repo, full="tree",'
221 221
222 222 # figure out which commits they are asking for and which ones they
223 223 # want us to stop on
224 for i in xrange(len(args)):
225 if args[i].startswith('^'):
226 s = repo.lookup(args[i][1:])
224 for i, arg in enumerate(args):
225 if arg.startswith('^'):
226 s = repo.lookup(arg[1:])
227 227 stop_sha1.append(s)
228 228 want_sha1.append(s)
229 elif args[i] != 'HEAD':
230 want_sha1.append(repo.lookup(args[i]))
229 elif arg != 'HEAD':
230 want_sha1.append(repo.lookup(arg))
231 231
232 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 234 reachable.append(set());
235 n = want_sha1[i];
236 235 visit = [n];
237 236 reachable[i].add(n)
238 237 while visit:
@@ -112,8 +112,8 b' class patchheader(object):'
112 112 self.message = self.message[2:]
113 113 break
114 114 ci = 0
115 for mi in xrange(len(self.message)):
116 while self.message[mi] != self.comments[ci]:
115 for mi in self.message:
116 while mi != self.comments[ci]:
117 117 ci += 1
118 118 del self.comments[ci]
119 119
@@ -827,8 +827,7 b' class queue:'
827 827
828 828 def isapplied(self, patch):
829 829 """returns (index, rev, patch)"""
830 for i in xrange(len(self.applied)):
831 a = self.applied[i]
830 for i, a in enumerate(self.applied):
832 831 if a.name == patch:
833 832 return (i, a.rev, a.name)
834 833 return None
@@ -1407,15 +1406,15 b' class queue:'
1407 1406 series = []
1408 1407 applied = []
1409 1408 qpp = None
1410 for i in xrange(len(lines)):
1411 if lines[i] == 'Patch Data:':
1409 for i, line in enumerate(lines):
1410 if line == 'Patch Data:':
1412 1411 datastart = i + 1
1413 elif lines[i].startswith('Dirstate:'):
1414 l = lines[i].rstrip()
1412 elif line.startswith('Dirstate:'):
1413 l = line.rstrip()
1415 1414 l = l[10:].split(' ')
1416 1415 qpp = [ bin(x) for x in l ]
1417 1416 elif datastart != None:
1418 l = lines[i].rstrip()
1417 l = line.rstrip()
1419 1418 se = statusentry(l)
1420 1419 file_ = se.name
1421 1420 if se.rev:
@@ -185,7 +185,7 b' def bunidiff(t1, t2, l1, l2, header1, he'
185 185 #
186 186 diff = bdiff.blocks(t1, t2)
187 187 hunk = None
188 for i in xrange(len(diff)):
188 for i, s1 in enumerate(diff):
189 189 # The first match is special.
190 190 # we've either found a match starting at line 0 or a match later
191 191 # in the file. If it starts later, old and new below will both be
@@ -195,7 +195,6 b' def bunidiff(t1, t2, l1, l2, header1, he'
195 195 else:
196 196 s = [0, 0, 0, 0]
197 197 delta = []
198 s1 = diff[i]
199 198 a1 = s[1]
200 199 a2 = s1[0]
201 200 b1 = s[3]
@@ -307,8 +307,7 b' class patchfile:'
307 307
308 308 def hashlines(self):
309 309 self.hash = {}
310 for x in xrange(len(self.lines)):
311 s = self.lines[x]
310 for x, s in enumerate(self.lines):
312 311 self.hash.setdefault(s, []).append(x)
313 312
314 313 def write_rej(self):
@@ -13,8 +13,8 b' import struct'
13 13 _b85dec = {}
14 14
15 15 def _mkb85dec():
16 for i in range(len(_b85chars)):
17 _b85dec[_b85chars[i]] = i
16 for i, c in enumerate(_b85chars):
17 _b85dec[c] = i
18 18
19 19 def b85encode(text, pad=False):
20 20 """encode text in base85 format"""
@@ -50,9 +50,9 b' def b85decode(text):'
50 50 for i in range(0, len(text), 5):
51 51 chunk = text[i:i+5]
52 52 acc = 0
53 for j in range(len(chunk)):
53 for j, c in enumerate(chunk):
54 54 try:
55 acc = acc * 85 + _b85dec[chunk[j]]
55 acc = acc * 85 + _b85dec[c]
56 56 except KeyError:
57 57 raise TypeError('Bad base85 character at byte %d' % (i + j))
58 58 if acc > 4294967295:
General Comments 0
You need to be logged in to leave comments. Login now