changeset 3468:0e68608bd11d

use xrange instead of range
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 19 Oct 2006 14:16:51 +0200
parents df7202f6887c
children fd8f1110562c
files hgext/hgk.py hgext/mq.py hgext/patchbomb.py mercurial/hgweb/hgweb_mod.py mercurial/localrepo.py mercurial/patch.py mercurial/verify.py
diffstat 7 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -177,7 +177,7 @@ def revtree(args, repo, full="tree", max
         if len(ar) == 0:
             return 1
         mask = 0
-        for i in range(len(ar)):
+        for i in xrange(len(ar)):
             if sha in reachable[i]:
                 mask |= 1 << i
 
@@ -190,7 +190,7 @@ def revtree(args, repo, full="tree", max
 
     # figure out which commits they are asking for and which ones they
     # want us to stop on
-    for i in range(len(args)):
+    for i in xrange(len(args)):
         if args[i].startswith('^'):
             s = repo.lookup(args[i][1:])
             stop_sha1.append(s)
@@ -199,7 +199,7 @@ def revtree(args, repo, full="tree", max
             want_sha1.append(repo.lookup(args[i]))
 
     # calculate the graph for the supplied commits
-    for i in range(len(want_sha1)):
+    for i in xrange(len(want_sha1)):
         reachable.append({});
         n = want_sha1[i];
         visit = [n];
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -593,7 +593,7 @@ class queue:
             if stop in chlog.nodemap:
                 stoprev = chlog.rev(stop)
 
-            for r in range(chlog.count() - 1, -1, -1):
+            for r in xrange(chlog.count() - 1, -1, -1):
                 n = chlog.node(r)
                 if n not in p:
                     h.append(n)
@@ -955,7 +955,7 @@ class queue:
             if comments:
                 # Remove existing message.
                 ci = 0
-                for mi in range(len(message)):
+                for mi in xrange(len(message)):
                     while message[mi] != comments[ci]:
                         ci += 1
                     del comments[ci]
@@ -1036,7 +1036,7 @@ class queue:
             # if the patch excludes a modified file, mark that file with mtime=0
             # so status can see it.
             mm = []
-            for i in range(len(m)-1, -1, -1):
+            for i in xrange(len(m)-1, -1, -1):
                 if not matchfn(m[i]):
                     mm.append(m[i])
                     del m[i]
@@ -1104,7 +1104,7 @@ class queue:
         if not length:
             length = len(self.series) - start
         if not missing:
-            for i in range(start, start+length):
+            for i in xrange(start, start+length):
                 pfx = ''
                 patch = pname(i)
                 if self.ui.verbose:
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -195,7 +195,7 @@ def patchbomb(ui, repo, *revs, **opts):
 
     ui.write(_('This patch series consists of %d patches.\n\n') % len(patches))
 
-    for p, i in zip(patches, range(len(patches))):
+    for p, i in zip(patches, xrange(len(patches))):
         jumbo.extend(p)
         msgs.append(makepatch(p, i + 1, len(patches)))
 
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -191,7 +191,7 @@ class hgweb(object):
             parity = (start - end) & 1
             cl = self.repo.changelog
             l = [] # build a list in forward order for efficiency
-            for i in range(start, end):
+            for i in xrange(start, end):
                 ctx = self.repo.changectx(i)
                 n = ctx.node()
 
@@ -234,9 +234,9 @@ class hgweb(object):
             qw = query.lower().split()
 
             def revgen():
-                for i in range(cl.count() - 1, 0, -100):
+                for i in xrange(cl.count() - 1, 0, -100):
                     l = []
-                    for j in range(max(0, i - 100), i):
+                    for j in xrange(max(0, i - 100), i):
                         ctx = self.repo.changectx(j)
                         l.append(ctx)
                     l.reverse()
@@ -322,7 +322,7 @@ class hgweb(object):
             l = []
             parity = (count - 1) & 1
 
-            for i in range(start, end):
+            for i in xrange(start, end):
                 ctx = fctx.filectx(i)
                 n = fl.node(i)
 
@@ -531,7 +531,7 @@ class hgweb(object):
             parity = 0
             cl = self.repo.changelog
             l = [] # build a list in forward order for efficiency
-            for i in range(start, end):
+            for i in xrange(start, end):
                 n = cl.node(i)
                 changes = cl.read(n)
                 hn = hex(n)
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1132,7 +1132,7 @@ class localrepository(repo.repository):
                 reqcnt += 1
                 self.ui.debug(_("request %d: %s\n") %
                             (reqcnt, " ".join(map(short, r))))
-                for p in range(0, len(r), 10):
+                for p in xrange(0, len(r), 10):
                     for b in remote.branches(r[p:p+10]):
                         self.ui.debug(_("received %s:%s\n") %
                                       (short(b[0]), short(b[1])))
@@ -1750,7 +1750,7 @@ class localrepository(repo.repository):
             self.hook("changegroup", node=hex(self.changelog.node(cor+1)),
                       source=srctype, url=url)
 
-            for i in range(cor + 1, cnr + 1):
+            for i in xrange(cor + 1, cnr + 1):
                 self.hook("incoming", node=hex(self.changelog.node(i)),
                           source=srctype, url=url)
 
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -220,7 +220,7 @@ def dogitpatch(patchname, gitpatches, cw
     tmpfp = os.fdopen(fd, 'w')
 
     try:
-        for i in range(len(gitpatches)):
+        for i in xrange(len(gitpatches)):
             p = gitpatches[i]
             if not p.copymod and not p.binary:
                 continue
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -48,7 +48,7 @@ def verify(repo):
     repo.ui.status(_("checking changesets\n"))
     checksize(repo.changelog, "changelog")
 
-    for i in range(repo.changelog.count()):
+    for i in xrange(repo.changelog.count()):
         changesets += 1
         n = repo.changelog.node(i)
         l = repo.changelog.linkrev(n)
@@ -81,7 +81,7 @@ def verify(repo):
     checkversion(repo.manifest, "manifest")
     checksize(repo.manifest, "manifest")
 
-    for i in range(repo.manifest.count()):
+    for i in xrange(repo.manifest.count()):
         n = repo.manifest.node(i)
         l = repo.manifest.linkrev(n)
 
@@ -142,7 +142,7 @@ def verify(repo):
 
         nodes = {nullid: 1}
         seen = {}
-        for i in range(fl.count()):
+        for i in xrange(fl.count()):
             revisions += 1
             n = fl.node(i)