##// 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 # 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:
@@ -112,8 +112,8 b' class patchheader(object):'
112 self.message = self.message[2:]
112 self.message = self.message[2:]
113 break
113 break
114 ci = 0
114 ci = 0
115 for mi in xrange(len(self.message)):
115 for mi in self.message:
116 while self.message[mi] != self.comments[ci]:
116 while mi != self.comments[ci]:
117 ci += 1
117 ci += 1
118 del self.comments[ci]
118 del self.comments[ci]
119
119
@@ -827,8 +827,7 b' class queue:'
827
827
828 def isapplied(self, patch):
828 def isapplied(self, patch):
829 """returns (index, rev, patch)"""
829 """returns (index, rev, patch)"""
830 for i in xrange(len(self.applied)):
830 for i, a in enumerate(self.applied):
831 a = self.applied[i]
832 if a.name == patch:
831 if a.name == patch:
833 return (i, a.rev, a.name)
832 return (i, a.rev, a.name)
834 return None
833 return None
@@ -1407,15 +1406,15 b' class queue:'
1407 series = []
1406 series = []
1408 applied = []
1407 applied = []
1409 qpp = None
1408 qpp = None
1410 for i in xrange(len(lines)):
1409 for i, line in enumerate(lines):
1411 if lines[i] == 'Patch Data:':
1410 if line == 'Patch Data:':
1412 datastart = i + 1
1411 datastart = i + 1
1413 elif lines[i].startswith('Dirstate:'):
1412 elif line.startswith('Dirstate:'):
1414 l = lines[i].rstrip()
1413 l = line.rstrip()
1415 l = l[10:].split(' ')
1414 l = l[10:].split(' ')
1416 qpp = [ bin(x) for x in l ]
1415 qpp = [ bin(x) for x in l ]
1417 elif datastart != None:
1416 elif datastart != None:
1418 l = lines[i].rstrip()
1417 l = line.rstrip()
1419 se = statusentry(l)
1418 se = statusentry(l)
1420 file_ = se.name
1419 file_ = se.name
1421 if se.rev:
1420 if se.rev:
@@ -185,7 +185,7 b' def bunidiff(t1, t2, l1, l2, header1, he'
185 #
185 #
186 diff = bdiff.blocks(t1, t2)
186 diff = bdiff.blocks(t1, t2)
187 hunk = None
187 hunk = None
188 for i in xrange(len(diff)):
188 for i, s1 in enumerate(diff):
189 # The first match is special.
189 # The first match is special.
190 # we've either found a match starting at line 0 or a match later
190 # we've either found a match starting at line 0 or a match later
191 # in the file. If it starts later, old and new below will both be
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 else:
195 else:
196 s = [0, 0, 0, 0]
196 s = [0, 0, 0, 0]
197 delta = []
197 delta = []
198 s1 = diff[i]
199 a1 = s[1]
198 a1 = s[1]
200 a2 = s1[0]
199 a2 = s1[0]
201 b1 = s[3]
200 b1 = s[3]
@@ -307,8 +307,7 b' class patchfile:'
307
307
308 def hashlines(self):
308 def hashlines(self):
309 self.hash = {}
309 self.hash = {}
310 for x in xrange(len(self.lines)):
310 for x, s in enumerate(self.lines):
311 s = self.lines[x]
312 self.hash.setdefault(s, []).append(x)
311 self.hash.setdefault(s, []).append(x)
313
312
314 def write_rej(self):
313 def write_rej(self):
@@ -13,8 +13,8 b' import struct'
13 _b85dec = {}
13 _b85dec = {}
14
14
15 def _mkb85dec():
15 def _mkb85dec():
16 for i in range(len(_b85chars)):
16 for i, c in enumerate(_b85chars):
17 _b85dec[_b85chars[i]] = i
17 _b85dec[c] = i
18
18
19 def b85encode(text, pad=False):
19 def b85encode(text, pad=False):
20 """encode text in base85 format"""
20 """encode text in base85 format"""
@@ -50,9 +50,9 b' def b85decode(text):'
50 for i in range(0, len(text), 5):
50 for i in range(0, len(text), 5):
51 chunk = text[i:i+5]
51 chunk = text[i:i+5]
52 acc = 0
52 acc = 0
53 for j in range(len(chunk)):
53 for j, c in enumerate(chunk):
54 try:
54 try:
55 acc = acc * 85 + _b85dec[chunk[j]]
55 acc = acc * 85 + _b85dec[c]
56 except KeyError:
56 except KeyError:
57 raise TypeError('Bad base85 character at byte %d' % (i + j))
57 raise TypeError('Bad base85 character at byte %d' % (i + j))
58 if acc > 4294967295:
58 if acc > 4294967295:
General Comments 0
You need to be logged in to leave comments. Login now