Mercurial > hg
changeset 3473: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 Thu Oct 19 14:03:41 2006 +0200 +++ b/hgext/hgk.py Thu Oct 19 14:16:51 2006 +0200 @@ -177,7 +177,7 @@ 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 @@ # 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 @@ 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 Thu Oct 19 14:03:41 2006 +0200 +++ b/hgext/mq.py Thu Oct 19 14:16:51 2006 +0200 @@ -593,7 +593,7 @@ 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 @@ 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 @@ # 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 @@ 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 Thu Oct 19 14:03:41 2006 +0200 +++ b/hgext/patchbomb.py Thu Oct 19 14:16:51 2006 +0200 @@ -195,7 +195,7 @@ 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 Thu Oct 19 14:03:41 2006 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Thu Oct 19 14:16:51 2006 +0200 @@ -191,7 +191,7 @@ 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 @@ 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 @@ 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 @@ 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 Thu Oct 19 14:03:41 2006 +0200 +++ b/mercurial/localrepo.py Thu Oct 19 14:16:51 2006 +0200 @@ -1132,7 +1132,7 @@ 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 @@ 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 Thu Oct 19 14:03:41 2006 +0200 +++ b/mercurial/patch.py Thu Oct 19 14:16:51 2006 +0200 @@ -220,7 +220,7 @@ 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 Thu Oct 19 14:03:41 2006 +0200 +++ b/mercurial/verify.py Thu Oct 19 14:16:51 2006 +0200 @@ -48,7 +48,7 @@ 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 @@ 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 @@ nodes = {nullid: 1} seen = {} - for i in range(fl.count()): + for i in xrange(fl.count()): revisions += 1 n = fl.node(i)