Mercurial > hg-stable
changeset 1749:d457fec76ab0
fix warnings from pychecker (unused variables and shadowing)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 19 Feb 2006 19:43:03 +0100 |
parents | 2428e6d66f06 |
children | 955a7caf005c |
files | mercurial/commands.py mercurial/dirstate.py mercurial/localrepo.py mercurial/revlog.py |
diffstat | 4 files changed, 29 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sun Feb 19 18:59:20 2006 +0100 +++ b/mercurial/commands.py Sun Feb 19 19:43:03 2006 +0100 @@ -115,8 +115,8 @@ yield rev minrev, maxrev = min(revs), max(revs) - for file in files: - filelog = repo.file(file) + for file_ in files: + filelog = repo.file(file_) # A zero count may be a directory or deleted file, so # try to find matching entries on the slow path. if filelog.count() == 0: @@ -127,7 +127,7 @@ if rev < minrev: break fncache.setdefault(rev, []) - fncache[rev].append(file) + fncache[rev].append(file_) wanted[rev] = 1 if slowpath: # The slow path checks files modified in every changeset. @@ -447,7 +447,6 @@ f = f.lstrip("^") if not ui.debugflag and f.startswith("debug"): continue - d = "" doc = e[0].__doc__ if not doc: doc = _("(No help text available)") @@ -1290,6 +1289,7 @@ s = linestate(line, lnum, cstart, cend) m[s] = s + # FIXME: prev isn't used, why ? prev = {} ucache = {} def display(fn, rev, states, prevstates):
--- a/mercurial/dirstate.py Sun Feb 19 18:59:20 2006 +0100 +++ b/mercurial/dirstate.py Sun Feb 19 19:43:03 2006 +0100 @@ -270,11 +270,11 @@ elif not dc: dc = self.filterfiles(files) - def statmatch(file, stat): - file = util.pconvert(file) - if file not in dc and self.ignore(file): + def statmatch(file_, stat): + file_ = util.pconvert(file_) + if file_ not in dc and self.ignore(file_): return False - return match(file) + return match(file_) return self.walkhelper(files=files, statmatch=statmatch, dc=dc) @@ -350,9 +350,9 @@ continue if stat.S_ISDIR(st.st_mode): cmp1 = (lambda x, y: cmp(x[1], y[1])) - sorted = [ x for x in findfiles(f) ] - sorted.sort(cmp1) - for e in sorted: + sorted_ = [ x for x in findfiles(f) ] + sorted_.sort(cmp1) + for e in sorted_: yield e else: ff = util.normpath(ff) @@ -380,7 +380,7 @@ for src, fn, st in self.statwalk(files, match): try: - type, mode, size, time = self[fn] + type_, mode, size, time = self[fn] except KeyError: unknown.append(fn) continue @@ -399,22 +399,22 @@ nonexistent = False # XXX: what to do with file no longer present in the fs # who are not removed in the dirstate ? - if nonexistent and type in "nm": + if nonexistent and type_ in "nm": deleted.append(fn) continue # check the common case first - if type == 'n': + if type_ == 'n': if not st: st = os.stat(fn) if size != st.st_size or (mode ^ st.st_mode) & 0100: modified.append(fn) elif time != st.st_mtime: lookup.append(fn) - elif type == 'm': + elif type_ == 'm': modified.append(fn) - elif type == 'a': + elif type_ == 'a': added.append(fn) - elif type == 'r': + elif type_ == 'r': removed.append(fn) return (lookup, modified, added, removed, deleted, unknown)
--- a/mercurial/localrepo.py Sun Feb 19 18:59:20 2006 +0100 +++ b/mercurial/localrepo.py Sun Feb 19 19:43:03 2006 +0100 @@ -231,7 +231,7 @@ self.join("journal"), after) def recover(self): - lock = self.lock() + l = self.lock() if os.path.exists(self.join("journal")): self.ui.status(_("rolling back interrupted transaction\n")) transaction.rollback(self.opener, self.join("journal")) @@ -245,7 +245,7 @@ def undo(self, wlock=None): if not wlock: wlock = self.wlock() - lock = self.lock() + l = self.lock() if os.path.exists(self.join("undo")): self.ui.status(_("rolling back last transaction\n")) transaction.rollback(self.opener, self.join("undo")) @@ -311,7 +311,7 @@ if not wlock: wlock = self.wlock() - lock = self.lock() + l = self.lock() tr = self.transaction() mm = m1.copy() mfm = mf1.copy() @@ -388,7 +388,7 @@ if not wlock: wlock = self.wlock() - lock = self.lock() + l = self.lock() tr = self.transaction() # check in files @@ -931,7 +931,7 @@ return subset def pull(self, remote, heads=None): - lock = self.lock() + l = self.lock() # if we have an empty repo, fetch everything if self.changelog.tip() == nullid: @@ -951,7 +951,7 @@ return self.addchangegroup(cg) def push(self, remote, force=False): - lock = remote.lock() + l = remote.lock() base = {} heads = remote.heads()
--- a/mercurial/revlog.py Sun Feb 19 18:59:20 2006 +0100 +++ b/mercurial/revlog.py Sun Feb 19 19:43:03 2006 +0100 @@ -624,12 +624,10 @@ # we store negative distances because heap returns smallest member h = [(-dist[node], node)] seen = {} - earliest = self.count() while h: d, n = heapq.heappop(h) if n not in seen: seen[n] = 1 - r = self.rev(n) yield (-d, n) for p in self.parents(n): heapq.heappush(h, (-dist[p], p)) @@ -690,11 +688,6 @@ p = self.parents(self.node(revs[0]))[0] revs.insert(0, self.rev(p)) - # helper to reconstruct intermediate versions - def construct(text, base, rev): - bins = [self.chunk(r) for r in xrange(base + 1, rev + 1)] - return mdiff.patches(text, bins) - # build deltas for d in xrange(0, len(revs) - 1): a, b = revs[d], revs[d + 1] @@ -738,10 +731,10 @@ base = prev = -1 start = end = measure = 0 if r: - start = self.start(self.base(t)) + base = self.base(t) + start = self.start(base) end = self.end(t) - measure = self.length(self.base(t)) - base = self.base(t) + measure = self.length(base) prev = self.tip() transaction.add(self.datafile, end) @@ -793,14 +786,15 @@ raise RevlogError(_("consistency error adding group")) measure = len(text) else: - e = (end, len(cdelta), self.base(t), link, p1, p2, node) + e = (end, len(cdelta), base, link, p1, p2, node) self.index.append(e) self.nodemap[node] = r dfh.write(cdelta) ifh.write(struct.pack(indexformat, *e)) t, r, chain, prev = r, r + 1, node, node - start = self.start(self.base(t)) + base = self.base(t) + start = self.start(base) end = self.end(t) dfh.close()