[PATCH 2 of 7] rename unused destructuring variables to start with underbar (_)

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Wed Mar 11 11:43:09 CDT 2009


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1236789722 -3600
rename unused destructuring variables to start with underbar (_)

This is so the PyDev Eclipse plugin no longer reports them as unused.
Doing this is beneficial as I also found a number of variables that
could be dropped entirely (see later patch).

I don't expect people to keep this up. I can do it again later. But
it does help to weed out false positives.

It would be helpful, though, if once people start using one of these
varialbles, that they remove the leading underbar.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -239,7 +239,7 @@
                 if not chunk:
                     break
                 self.bundlefilespos[chunk] = self.bundlefile.tell()
-                for c in changegroup.chunkiter(self.bundlefile):
+                for _c in changegroup.chunkiter(self.bundlefile):
                     pass
 
         if f[0] == '/':
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -255,7 +255,7 @@
             equal = 0
             alines = mdiff.splitnewlines(aa)
             matches = bdiff.blocks(aa, rr)
-            for x1,x2,y1,y2 in matches:
+            for x1,x2,_y1,_y2 in matches:
                 for line in alines[x1:x2]:
                     equal += len(line)
 
@@ -924,9 +924,9 @@
     """Find the tipmost changeset that matches the given date spec"""
     df = util.matchdate(date)
     get = util.cachefunc(lambda r: repo[r].changeset())
-    changeiter, matchfn = walkchangerevs(ui, repo, [], get, {'rev':None})
+    changeiter, _matchfn = walkchangerevs(ui, repo, [], get, {'rev':None})
     results = {}
-    for st, rev, fns in changeiter:
+    for st, rev, _fns in changeiter:
         if st == 'add':
             d = get(rev)[2]
             if df(d[0]):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -205,7 +205,7 @@
     cmdutil.bail_if_changed(repo)
     node = repo.lookup(rev)
 
-    op1, op2 = repo.dirstate.parents()
+    op1, _op2 = repo.dirstate.parents()
     a = repo.changelog.ancestor(op1, node)
     if a != node:
         raise util.Abort(_('cannot back out change on a different branch'))
@@ -507,7 +507,7 @@
                         visit.append(p)
     else:
         cmdutil.setremoteconfig(ui, opts)
-        dest, revs, checkout = hg.parseurl(
+        dest, revs, _checkout = hg.parseurl(
             ui.expandpath(dest or 'default-push', dest or 'default'), revs)
         other = hg.repository(ui, dest)
         o = repo.findoutgoing(other, force=opts.get('force'))
@@ -693,7 +693,7 @@
         options = []
         otables = [globalopts]
         if cmd:
-            aliases, entry = cmdutil.findcmd(cmd, table, False)
+            _aliases, entry = cmdutil.findcmd(cmd, table, False)
             otables.append(entry[1])
         for t in otables:
             for o in t:
@@ -1206,7 +1206,7 @@
     fstate = {}
     skip = {}
     get = util.cachefunc(lambda r: repo[r].changeset())
-    changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
+    changeiter, _matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
     found = False
     follow = opts.get('follow')
     for st, rev, fns in changeiter:
@@ -1500,7 +1500,7 @@
     if not name:
         ui.write(_("\nadditional help topics:\n\n"))
         topics = []
-        for names, header, doc in help.helptable:
+        for names, header, _doc in help.helptable:
             names = [(-len(name), name) for name in names]
             names.sort()
             topics.append((names[0][1], header))
@@ -1540,7 +1540,7 @@
 
     revs = []
     if source:
-        source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
+        source, revs, _checkout = hg.parseurl(ui.expandpath(source), [])
         repo = hg.repository(ui, source)
 
     if not repo.local():
@@ -1726,15 +1726,15 @@
     See pull for valid source format details.
     """
     limit = cmdutil.loglimit(opts)
-    source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
+    source, revs, _checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
     cmdutil.setremoteconfig(ui, opts)
 
     other = hg.repository(ui, source)
     ui.status(_('comparing with %s\n') % url.hidepassword(source))
     if revs:
         revs = [other.lookup(rev) for rev in revs]
-    common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
-                                                       force=opts["force"])
+    _common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
+                                                        force=opts["force"])
     if not incoming:
         try:
             os.unlink(opts["bundle"])
@@ -1912,7 +1912,7 @@
     only_branches = opts.get('only_branch')
 
     displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
-    for st, rev, fns in changeiter:
+    for st, rev, _fns in changeiter:
         if st == 'add':
             parents = [p for p in repo.changelog.parentrevs(rev)
                        if p != nullrev]
@@ -2048,7 +2048,7 @@
     See pull for valid destination format details.
     """
     limit = cmdutil.loglimit(opts)
-    dest, revs, checkout = hg.parseurl(
+    dest, revs, _checkout = hg.parseurl(
         ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
     cmdutil.setremoteconfig(ui, opts)
     if revs:
@@ -2198,7 +2198,7 @@
     If DESTINATION is omitted, a default path will be used.
     See 'hg help urls' for more information.
     """
-    dest, revs, checkout = hg.parseurl(
+    dest, revs, _checkout = hg.parseurl(
         ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
     cmdutil.setremoteconfig(ui, opts)
 
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -419,7 +419,7 @@
             visit.extend(fn)
 
         hist = {}
-        for r, f in util.sort(visit):
+        for _r, f in util.sort(visit):
             curr = decorate(f.data(), f)
             for p in parents(f):
                 if p != nullid:
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -88,7 +88,7 @@
                 return 1
 
 def wrapcommand(table, command, wrapper):
-    aliases, entry = cmdutil.findcmd(command, table)
+    _aliases, entry = cmdutil.findcmd(command, table)
     for alias, e in table.iteritems():
         if e is entry:
             key = alias
diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py
--- a/mercurial/fancyopts.py
+++ b/mercurial/fancyopts.py
@@ -52,7 +52,7 @@
     argmap = {}
     defmap = {}
 
-    for short, name, default, comment in options:
+    for short, name, default, _comment in options:
         # convert opts to getopt format
         oname = name
         name = name.replace('-', '_')
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -61,7 +61,7 @@
 
     # then merge tools
     tools = {}
-    for k,v in ui.configitems("merge-tools"):
+    for k,_v in ui.configitems("merge-tools"):
         t = k.split('.')[0]
         if t not in tools:
             tools[t] = int(_toolstr(ui, t, "priority", "0"))
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -60,7 +60,7 @@
     """return a repository object for the specified path"""
     repo = _lookup(path).instance(ui, path, create)
     ui = getattr(repo, "ui", ui)
-    for name, module in extensions.extensions():
+    for _name, module in extensions.extensions():
         hook = getattr(module, 'reposetup', None)
         if hook:
             hook(ui, repo)
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -256,7 +256,7 @@
                 rows.sort()
                 if descending:
                     rows.reverse()
-                for key, row in rows:
+                for _key, row in rows:
                     row['parity'] = parity.next()
                     yield row
 
diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -61,7 +61,7 @@
     def drain(self):
         '''need to read all data from request, httplib is half-duplex'''
         length = int(self.env.get('CONTENT_LENGTH', 0))
-        for s in util.filechunkiter(self.inp, limit=length):
+        for _s in util.filechunkiter(self.inp, limit=length):
             pass
 
     def respond(self, status, type=None, filename=None, length=0):
@@ -71,7 +71,7 @@
             if not self.headers:
                 raise RuntimeError("request.write called before headers sent")
 
-            for k, v in self.headers:
+            for _k, v in self.headers:
                 if not isinstance(v, str):
                     raise TypeError('header value must be string: %r' % v)
 
diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -148,7 +148,7 @@
         self.sent_headers = True
 
     def _start_response(self, http_status, headers, exc_info=None):
-        code, msg = http_status.split(None, 1)
+        code, _msg = http_status.split(None, 1)
         code = int(code)
         self.saved_status = http_status
         bad_headers = ('connection', 'transfer-encoding')
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -273,7 +273,7 @@
     l = len(path)
     abspath = "/" + path
 
-    for f, n in mf.iteritems():
+    for f, _n in mf.iteritems():
         if f[:l] != path:
             continue
         remain = f[l:]
@@ -385,7 +385,7 @@
 
         b = web.repo.branchtags()
         l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()]
-        for r,n,t in util.sort(l):
+        for _r,n,t in util.sort(l):
             yield {'parity': parity.next(),
                    'branch': t,
                    'node': hex(n),
diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -25,7 +25,7 @@
         self.path = path
         self.caps = None
         self.handler = None
-        scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
+        _scheme, _netloc, _urlpath, query, frag = urlparse.urlsplit(path)
         if query or frag:
             raise util.Abort(_('unsupported URL component: "%s"') %
                              (query or frag))
diff --git a/mercurial/ignore.py b/mercurial/ignore.py
--- a/mercurial/ignore.py
+++ b/mercurial/ignore.py
@@ -79,12 +79,12 @@
         return util.never
 
     try:
-        files, ignorefunc, anypats = (
+        files, ignorefunc, _anypats = (
             util.matcher(root, inc=allpats, src='.hgignore'))
     except util.Abort:
         # Re-raise an exception where the src is the right file
         for f, patlist in pats.iteritems():
-            files, ignorefunc, anypats = (
+            files, ignorefunc, _anypats = (
                 util.matcher(root, inc=patlist, src=f))
 
     return ignorefunc
diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -197,7 +197,7 @@
 
     def close_all(self):
         """close all open connections"""
-        for host, conns in self._cm.get_all().iteritems():
+        for _host, conns in self._cm.get_all().iteritems():
             for h in conns:
                 self._cm.remove(h)
                 h.close()
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -291,7 +291,7 @@
 
         # read the tags file from each head, ending with the tip
         f = None
-        for rev, node, fnode in self._hgtagsnodes():
+        for _rev, _node, fnode in self._hgtagsnodes():
             f = (f and f.filectx(fnode) or
                  self.filectx('.hgtags', fileid=fnode))
             readtags(f.data().splitlines(), f, "global")
@@ -385,7 +385,7 @@
         else:
             self.branchcache.clear() # keep using the same dict
         if oldtip is None or oldtip not in self.changelog.nodemap:
-            partial, last, lrev = self._readbranchcache()
+            partial, _last, lrev = self._readbranchcache()
         else:
             lrev = self.changelog.rev(oldtip)
             partial = self._ubranchcache
@@ -1208,7 +1208,7 @@
             return ('close' not in extras)
         # sort the output in rev descending order
         heads = [(-self.changelog.rev(h), h) for h in heads if display(h)]
-        return [n for (r, n) in util.sort(heads)]
+        return [n for (_r, n) in util.sort(heads)]
 
     def branchheads(self, branch=None, start=None, closed=True):
         if branch is None:
@@ -1471,7 +1471,7 @@
     def pull(self, remote, heads=None, force=False):
         lock = self.lock()
         try:
-            common, fetch, rheads = self.findcommonincoming(remote, heads=heads,
+            _common, fetch, rheads = self.findcommonincoming(remote, heads=heads,
                                                             force=force)
             if fetch == [nullid]:
                 self.ui.status(_("requesting all changes\n"))
@@ -1511,9 +1511,9 @@
         remote_heads = remote.heads()
         inc = self.findincoming(remote, common, remote_heads, force=force)
 
-        update, updated_heads = self.findoutgoing(remote, common, remote_heads)
+        update, _updated_heads = self.findoutgoing(remote, common, remote_heads)
         if revs is not None:
-            msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
+            _msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
         else:
             bases, heads = update, self.changelog.heads()
 
@@ -1568,7 +1568,7 @@
         try:
             ret = self.prepush(remote, force, revs)
             if ret[0] is not None:
-                cg, remote_heads = ret
+                cg, _remote_heads = ret
                 return remote.addchangegroup(cg, 'push', self.url())
             return ret[1]
         finally:
@@ -1656,8 +1656,8 @@
             # changesets are known.  The recipient must know about all
             # changesets required to reach the known heads from the null
             # changeset.
-            has_cl_set, junk, junk = cl.nodesbetween(None, knownheads)
-            junk = None
+            has_cl_set, _junk, _junk = cl.nodesbetween(None, knownheads)
+            _junk = None
             # Transform the list into an ersatz set.
             has_cl_set = dict.fromkeys(has_cl_set)
         else:
@@ -1672,8 +1672,8 @@
         # Nor do we know which filenodes are missing.
         msng_filenode_set = {}
 
-        junk = mnfst.index[len(mnfst) - 1] # Get around a bug in lazyindex
-        junk = None
+        _junk = mnfst.index[len(mnfst) - 1] # Get around a bug in lazyindex
+        _junk = None
 
         # A changeset always belongs to itself, so the changenode lookup
         # function for a changenode is identity.
@@ -2106,7 +2106,7 @@
         self.ui.status(_('%d files to transfer, %s of data\n') %
                        (total_files, util.bytecount(total_bytes)))
         start = time.time()
-        for i in xrange(total_files):
+        for _i in xrange(total_files):
             # XXX doesn't support '\n' or '\r' in filenames
             l = fp.readline()
             try:
diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -248,7 +248,7 @@
     pos = 0
     t = []
     while pos < len(bin):
-        p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12])
+        _p1, _p2, l = struct.unpack(">lll", bin[pos:pos + 12])
         pos += 12
         t.append(bin[pos:pos + l])
         pos += l
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -59,7 +59,7 @@
     def resolve(self, dfile, wctx, octx):
         if self[dfile] == 'r':
             return 0
-        state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
+        _state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
         f = self._repo.opener("merge/" + hash)
         self._repo.wwrite(dfile, f.read(), flags)
         fcd = wctx[dfile]
@@ -381,7 +381,7 @@
             else:
                 repo.dirstate.normal(f)
         elif m == "m": # merge
-            f2, fd, flag, move = a[2:]
+            f2, fd, _flag, move = a[2:]
             if branchmerge:
                 # We've done a branch merge, mark this file as merged
                 # so that we properly record the merger later
@@ -403,7 +403,7 @@
                 if move:
                     repo.dirstate.forget(f)
         elif m == "d": # directory rename
-            f2, fd, flag = a[2:]
+            f2, fd, _flag = a[2:]
             if not f2 and f not in repo.dirstate:
                 # untracked file moved
                 continue
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -187,7 +187,7 @@
             if m:
                 if gp:
                     gitpatches.append(gp)
-                src, dst = m.group(1, 2)
+                _src, dst = m.group(1, 2)
                 gp = patchmeta(dst)
                 gp.lineno = lineno
         elif gp:
@@ -450,7 +450,7 @@
         m = unidesc.match(self.desc)
         if not m:
             raise PatchError(_("bad hunk #%d") % self.number)
-        self.starta, foo, self.lena, self.startb, foo2, self.lenb = m.groups()
+        self.starta, _foo, self.lena, self.startb, _foo, self.lenb = m.groups()
         if self.lena == None:
             self.lena = 1
         else:
@@ -476,7 +476,7 @@
         m = contextdesc.match(self.desc)
         if not m:
             raise PatchError(_("bad hunk #%d") % self.number)
-        foo, self.starta, foo2, aend, foo3 = m.groups()
+        _foo, self.starta, _foo, aend, _foo = m.groups()
         self.starta = int(self.starta)
         if aend == None:
             aend = self.starta
@@ -508,7 +508,7 @@
         m = contextdesc.match(l)
         if not m:
             raise PatchError(_("bad hunk #%d") % self.number)
-        foo, self.startb, foo2, bend, foo3 = m.groups()
+        _foo, self.startb, _foo, bend, _foo = m.groups()
         self.startb = int(self.startb)
         if bend == None:
             bend = self.startb
@@ -1234,7 +1234,7 @@
         r = [hexfunc(node) for node in [node1, node2] if node]
 
     if opts.git:
-        copy, diverge = copies.copies(repo, ctx1, ctx2, repo[nullid])
+        copy, _diverge = copies.copies(repo, ctx1, ctx2, repo[nullid])
         for k, v in copy.items():
             copy[v] = k
 
diff --git a/mercurial/pure/diffhelpers.py b/mercurial/pure/diffhelpers.py
--- a/mercurial/pure/diffhelpers.py
+++ b/mercurial/pure/diffhelpers.py
@@ -12,7 +12,7 @@
         num = max(todoa, todob)
         if num == 0:
             break
-        for i in xrange(num):
+        for _i in xrange(num):
             s = fp.readline()
             c = s[0]
             if s == "\\ No newline at end of file\n":
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -135,7 +135,7 @@
         while cur < end:
             data = self.dataf.read(blocksize)
             off = 0
-            for x in xrange(256):
+            for _x in xrange(256):
                 n = data[off + ngshaoffset:off + ngshaoffset + 20]
                 self.map[n] = count
                 count += 1
diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -293,7 +293,7 @@
             if region[0] != "conflict":
                 yield region
                 continue
-            type, iz, zmatch, ia, amatch, ib, bmatch = region
+            type, _iz, _zmatch, ia, amatch, ib, bmatch = region
             a_region = self.a[ia:amatch]
             b_region = self.b[ib:bmatch]
             matches = mdiff.get_matching_blocks(''.join(a_region),
diff --git a/mercurial/sshserver.py b/mercurial/sshserver.py
--- a/mercurial/sshserver.py
+++ b/mercurial/sshserver.py
@@ -92,7 +92,7 @@
         self.respond("")
 
     def do_branches(self):
-        arg, nodes = self.getarg()
+        _arg, nodes = self.getarg()
         nodes = map(bin, nodes.split(" "))
         r = []
         for b in self.repo.branches(nodes):
@@ -100,7 +100,7 @@
         self.respond("".join(r))
 
     def do_between(self):
-        arg, pairs = self.getarg()
+        _arg, pairs = self.getarg()
         pairs = [map(bin, p.split("-")) for p in pairs.split(" ")]
         r = []
         for b in self.repo.between(pairs):
@@ -108,8 +108,7 @@
         self.respond("".join(r))
 
     def do_changegroup(self):
-        nodes = []
-        arg, roots = self.getarg()
+        _arg, roots = self.getarg()
         nodes = map(bin, roots.split(" "))
 
         cg = self.repo.changegroup(nodes, 'serve')
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -46,7 +46,7 @@
             repo.ui.debug(_('scanning\n'))
             # get consistent snapshot of repo, lock during scan
             l = repo.lock()
-            for name, ename, size in repo.store.walk():
+            for name, _ename, size in repo.store.walk():
                 entries.append((name, size))
                 total_bytes += size
         finally:
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -82,7 +82,7 @@
 
         self.report(_("transaction abort!\n"))
 
-        for f, o, ignore in self.entries:
+        for f, o, _ignore in self.entries:
             try:
                 self.opener(f, "a").truncate(o)
             except:
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -781,7 +781,7 @@
 
     if os.path.isdir(src):
         os.mkdir(dst)
-        for name, kind in osutil.listdir(src):
+        for name, _kind in osutil.listdir(src):
             srcname = os.path.join(src, name)
             dstname = os.path.join(dst, name)
             copyfiles(srcname, dstname, hardlink)
@@ -845,7 +845,7 @@
                                 (path, prefix))
         parts.pop()
         prefixes = []
-        for n in range(len(parts)):
+        for _n in range(len(parts)):
             prefix = os.sep.join(parts)
             if prefix in self.auditeddir:
                 break
@@ -919,7 +919,7 @@
         if cache is None:
             try:
                 dmap = dict([(ncase(n), s)
-                    for n, k, s in osutil.listdir(dir, True)])
+                    for n, _k, s in osutil.listdir(dir, True)])
             except OSError, err:
                 # handle directory not found in Python version prior to 2.5
                 # Python <= 2.4 returns native Windows code 3 in errno
@@ -1320,7 +1320,7 @@
         rcdir = os.path.join(path, 'hgrc.d')
         try:
             rcs.extend([os.path.join(rcdir, f)
-                        for f, kind in osutil.listdir(rcdir)
+                        for f, _kind in osutil.listdir(rcdir)
                         if f.endswith(".rc")])
         except OSError:
             pass
@@ -1345,7 +1345,7 @@
             if pf[0] == '`':
                 pf = pf[1:-1] # Remove the quotes
         else:
-           if pf.startswith("'") and pf.endswith("'") and " " in pf:
+            if pf.startswith("'") and pf.endswith("'") and " " in pf:
                 pf = pf[1:-1] # Remove the quotes
         return pf
 
@@ -1911,7 +1911,7 @@
     if (seen_dirs is None) and followsym:
         seen_dirs = []
         _add_dir_if_not_there(seen_dirs, path)
-    for root, dirs, files in os.walk(path, topdown=True, onerror=errhandler):
+    for root, dirs, _files in os.walk(path, topdown=True, onerror=errhandler):
         if '.hg' in dirs:
             yield root # found a repository
             qroot = os.path.join(root, '.hg', 'patches')
@@ -1956,7 +1956,7 @@
             for p in os.environ['HGRCPATH'].split(os.pathsep):
                 if not p: continue
                 if os.path.isdir(p):
-                    for f, kind in osutil.listdir(p):
+                    for f, _kind in osutil.listdir(p):
                         if f.endswith('.rc'):
                             _rcpath.append(os.path.join(p, f))
                 else:
diff --git a/mercurial/util_win32.py b/mercurial/util_win32.py
--- a/mercurial/util_win32.py
+++ b/mercurial/util_win32.py
@@ -237,7 +237,7 @@
             if p.lower().endswith('mercurial.ini'):
                 rcpath.append(p)
             elif os.path.isdir(p):
-                for f, kind in osutil.listdir(p):
+                for f, _kind in osutil.listdir(p):
                     if f.endswith('.rc'):
                         rcpath.append(os.path.join(p, f))
         return rcpath
@@ -304,7 +304,7 @@
                 wincount = int(count)
                 if wincount == -1:
                     wincount = 1048576
-                val, data = win32file.ReadFile(self.handle, wincount)
+                _val, data = win32file.ReadFile(self.handle, wincount)
                 if not data: break
                 cs.write(data)
                 if count != -1:
@@ -324,7 +324,7 @@
                 win32file.SetFilePointer(self.handle, 0, win32file.FILE_END)
             nwrit = 0
             while nwrit < len(data):
-                val, nwrit = win32file.WriteFile(self.handle, data)
+                _val, nwrit = win32file.WriteFile(self.handle, data)
                 data = data[nwrit:]
         except pywintypes.error, err:
             raise WinIOError(err)


More information about the Mercurial-devel mailing list