remove unused variables
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Tue, 28 Oct 2008 19:25:26 +0100
changeset 7280 810ca383da9c
parent 7279 1f0f84660dea
child 7281 f96c20e9b56a
remove unused variables
hgext/bookmarks.py
hgext/bugzilla.py
hgext/convert/cvsps.py
hgext/graphlog.py
hgext/inotify/client.py
hgext/inotify/server.py
hgext/mq.py
hgext/purge.py
hgext/rebase.py
hgext/transplant.py
hgext/zeroconf/__init__.py
mercurial/cmdutil.py
mercurial/commands.py
mercurial/dirstate.py
mercurial/dispatch.py
mercurial/graphmod.py
mercurial/hg.py
mercurial/hgweb/server.py
mercurial/hgweb/webcommands.py
mercurial/hook.py
mercurial/httprepo.py
mercurial/simplemerge.py
mercurial/store.py
mercurial/streamclone.py
--- a/hgext/bookmarks.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/bookmarks.py	Tue Oct 28 19:25:26 2008 +0100
@@ -150,7 +150,7 @@
     for mark, n in marks.items():
         if repo.changelog.rev(n) in revisions:
             update.append(mark)
-    result = oldstrip(ui, repo, node, backup)
+    oldstrip(ui, repo, node, backup)
     if len(update) > 0:
         for m in update:
             marks[m] = repo.changectx('.').node()
--- a/hgext/bugzilla.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/bugzilla.py	Tue Oct 28 19:25:26 2008 +0100
@@ -88,7 +88,7 @@
         self.ui.note(_('query: %s %s\n') % (args, kwargs))
         try:
             self.cursor.execute(*args, **kwargs)
-        except MySQLdb.MySQLError, err:
+        except MySQLdb.MySQLError:
             self.ui.note(_('failed query: %s %s\n') % (args, kwargs))
             raise
 
--- a/hgext/convert/cvsps.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/convert/cvsps.py	Tue Oct 28 19:25:26 2008 +0100
@@ -8,7 +8,6 @@
 
 import os
 import re
-import sys
 import cPickle as pickle
 from mercurial import util
 from mercurial.i18n import _
--- a/hgext/graphlog.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/graphlog.py	Tue Oct 28 19:25:26 2008 +0100
@@ -87,7 +87,6 @@
     """
 
     assert start_rev >= stop_rev
-    curr_rev = start_rev
     revs = []
     filerev = len(repo.file(path)) - 1
     while filerev >= 0:
--- a/hgext/inotify/client.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/inotify/client.py	Tue Oct 28 19:25:26 2008 +0100
@@ -9,7 +9,7 @@
 from mercurial.i18n import _
 from mercurial import ui
 import common
-import os, select, socket, stat, struct, sys
+import os, socket, struct
 
 def query(ui, repo, names, match, ignored, clean, unknown=True):
     sock = socket.socket(socket.AF_UNIX)
--- a/hgext/inotify/server.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/inotify/server.py	Tue Oct 28 19:25:26 2008 +0100
@@ -402,7 +402,7 @@
             ret = st.st_mode, st.st_size, st.st_mtime
             self.statcache[wpath] = ret
             return ret
-        except OSError, err:
+        except OSError:
             self.statcache.pop(wpath, None)
             raise
 
@@ -413,7 +413,7 @@
             st = self.stat(wpath)
             if stat.S_ISREG(st[0]):
                 self.updatestatus(wpath, st)
-        except OSError, err:
+        except OSError:
             pass
 
     def modified(self, wpath):
--- a/hgext/mq.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/mq.py	Tue Oct 28 19:25:26 2008 +0100
@@ -185,7 +185,6 @@
         patchguards = self.series_guards[idx]
         if not patchguards:
             return True, None
-        default = False
         guards = self.active()
         exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards]
         if exactneg:
@@ -707,7 +706,7 @@
                 except:
                     repo.rollback()
                     raise
-            except Exception, inst:
+            except Exception:
                 patchpath = self.join(patchfn)
                 try:
                     os.unlink(patchpath)
--- a/hgext/purge.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/purge.py	Tue Oct 28 19:25:26 2008 +0100
@@ -65,7 +65,7 @@
         if act:
             try:
                 remove_func(os.path.join(repo.root, name))
-            except OSError, e:
+            except OSError:
                 m = _('%s cannot be removed') % name
                 if opts['abort_on_err']:
                     raise util.Abort(m)
--- a/hgext/rebase.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/rebase.py	Tue Oct 28 19:25:26 2008 +0100
@@ -29,7 +29,7 @@
     If a rebase is interrupted to manually resolve a merge, it can be continued
     with --continue or aborted with --abort.
     """
-    originalwd = target = source = None
+    originalwd = target = None
     external = nullrev
     state = skipped = {}
 
--- a/hgext/transplant.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/transplant.py	Tue Oct 28 19:25:26 2008 +0100
@@ -455,14 +455,6 @@
     If a changeset application fails, you can fix the merge by hand and
     then resume where you left off by calling hg transplant --continue.
     '''
-    def getoneitem(opts, item, errmsg):
-        val = opts.get(item)
-        if val:
-            if len(val) > 1:
-                raise util.Abort(errmsg)
-            else:
-                return val[0]
-
     def getremotechanges(repo, url):
         sourcerepo = ui.expandpath(url)
         source = hg.repository(ui, sourcerepo)
--- a/hgext/zeroconf/__init__.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/hgext/zeroconf/__init__.py	Tue Oct 28 19:25:26 2008 +0100
@@ -87,7 +87,6 @@
             u = ui.ui(parentui=self.parentui)
             u.readconfig(os.path.join(path, '.hg', 'hgrc'))
             n = os.path.basename(r)
-            desc = u.config("web", "description", n)
             publish(n, "hgweb", p, int(repo.ui.config("web", "port", 8000)))
         return super(hgwebdirzc, self).run()
 
--- a/mercurial/cmdutil.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/cmdutil.py	Tue Oct 28 19:25:26 2008 +0100
@@ -1154,7 +1154,6 @@
     if pats:
         modified, added, removed = repo.status(match=m)[:3]
         files = util.sort(modified + added + removed)
-        slist = None
 
         def is_dir(f):
             name = f + '/'
--- a/mercurial/commands.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/commands.py	Tue Oct 28 19:25:26 2008 +0100
@@ -11,7 +11,7 @@
 import os, re, sys
 import hg, util, revlog, bundlerepo, extensions, copies
 import difflib, patch, time, help, mdiff, tempfile, url
-import version, socket
+import version
 import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect
 import merge as merge_
 
--- a/mercurial/dirstate.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/dirstate.py	Tue Oct 28 19:25:26 2008 +0100
@@ -441,7 +441,6 @@
         normalize = self.normalize
         listdir = osutil.listdir
         lstat = os.lstat
-        pconvert = util.pconvert
         getkind = stat.S_IFMT
         dirkind = stat.S_IFDIR
         regkind = stat.S_IFREG
@@ -536,9 +535,6 @@
         lookup, modified, added, unknown, ignored = [], [], [], [], []
         removed, deleted, clean = [], [], []
 
-        _join = self._join
-        lstat = os.lstat
-        cmap = self._copymap
         dmap = self._map
         ladd = lookup.append
         madd = modified.append
--- a/mercurial/dispatch.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/dispatch.py	Tue Oct 28 19:25:26 2008 +0100
@@ -374,7 +374,7 @@
     def checkargs():
         try:
             return cmdfunc()
-        except TypeError, inst:
+        except TypeError:
             # was this an argument error?
             tb = traceback.extract_tb(sys.exc_info()[2])
             if len(tb) != 2: # no
--- a/mercurial/graphmod.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/graphmod.py	Tue Oct 28 19:25:26 2008 +0100
@@ -35,8 +35,6 @@
     new_color = 1
 
     while curr_rev >= stop_rev:
-        node = cl.node(curr_rev)
-
         # Compute revs and next_revs
         if curr_rev not in revs:
             revs.append(curr_rev) # new head
--- a/mercurial/hg.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/hg.py	Tue Oct 28 19:25:26 2008 +0100
@@ -256,7 +256,6 @@
 
 def update(repo, node):
     """update the working directory to node, merging linear changes"""
-    pl = repo.parents()
     stats = _merge.update(repo, node, False, False, None)
     _showstats(repo, stats)
     if stats[3]:
@@ -274,7 +273,6 @@
     stats = _merge.update(repo, node, True, force, False)
     _showstats(repo, stats)
     if stats[3]:
-        pl = repo.parents()
         repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
     elif remind:
         repo.ui.status(_("(branch merge, don't forget to commit)\n"))
--- a/mercurial/hgweb/server.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/hgweb/server.py	Tue Oct 28 19:25:26 2008 +0100
@@ -66,7 +66,7 @@
     def do_POST(self):
         try:
             self.do_write()
-        except StandardError, inst:
+        except StandardError:
             self._start_response("500 Internal Server Error", [])
             self._write("Internal Server Error")
             tb = "".join(traceback.format_exception(*sys.exc_info()))
--- a/mercurial/hgweb/webcommands.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/hgweb/webcommands.py	Tue Oct 28 19:25:26 2008 +0100
@@ -59,8 +59,6 @@
 def _filerevision(web, tmpl, fctx):
     f = fctx.path()
     text = fctx.data()
-    fl = fctx.filelog()
-    n = fctx.filenode()
     parity = paritygen(web.stripecount)
 
     if binary(text):
@@ -420,7 +418,7 @@
     fctx, ctx = None, None
     try:
         fctx = webutil.filectx(web.repo, req)
-    except LookupError, inst:
+    except LookupError:
         ctx = webutil.changectx(web.repo, req)
         path = webutil.cleanpath(web.repo, req.form['file'][0])
         if path not in ctx.files():
@@ -458,8 +456,6 @@
 def annotate(web, req, tmpl):
     fctx = webutil.filectx(web.repo, req)
     f = fctx.path()
-    n = fctx.filenode()
-    fl = fctx.filelog()
     parity = paritygen(web.stripecount)
 
     def annotate(**map):
@@ -520,7 +516,6 @@
 
         for i in xrange(start, end):
             ctx = fctx.filectx(i)
-            n = fl.node(i)
 
             l.insert(0, {"parity": parity.next(),
                          "filerev": i,
--- a/mercurial/hook.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/hook.py	Tue Oct 28 19:25:26 2008 +0100
@@ -39,7 +39,7 @@
         try:
             for p in funcname.split('.')[1:]:
                 obj = getattr(obj, p)
-        except AttributeError, err:
+        except AttributeError:
             raise util.Abort(_('%s hook is invalid '
                                '("%s" is not defined)') %
                              (hname, funcname))
--- a/mercurial/httprepo.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/httprepo.py	Tue Oct 28 19:25:26 2008 +0100
@@ -9,7 +9,7 @@
 from node import bin, hex, nullid
 from i18n import _
 import repo, os, urllib, urllib2, urlparse, zlib, util, httplib
-import errno, keepalive, socket, changegroup, statichttprepo
+import errno, socket, changegroup, statichttprepo
 import url
 
 def zgenerator(f):
@@ -17,7 +17,7 @@
     try:
         for chunk in util.filechunkiter(f):
             yield zd.decompress(chunk)
-    except httplib.HTTPException, inst:
+    except httplib.HTTPException:
         raise IOError(None, _('connection ended unexpectedly'))
     yield zd.flush()
 
--- a/mercurial/simplemerge.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/simplemerge.py	Tue Oct 28 19:25:26 2008 +0100
@@ -432,7 +432,6 @@
     basetext = readfile(base)
     othertext = readfile(other)
 
-    orig = local
     local = os.path.realpath(local)
     if not opts.get('print'):
         opener = util.opener(os.path.dirname(local))
--- a/mercurial/store.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/store.py	Tue Oct 28 19:25:26 2008 +0100
@@ -154,7 +154,6 @@
         '''yields (unencoded, encoded, size)'''
         path = self.pathjoiner(self.path, relpath)
         striplen = len(self.path) + len(os.sep)
-        prefix = path[striplen:]
         l = []
         if os.path.isdir(path):
             visit = [path]
--- a/mercurial/streamclone.py	Tue Oct 28 19:07:14 2008 +0100
+++ b/mercurial/streamclone.py	Tue Oct 28 19:25:26 2008 +0100
@@ -51,7 +51,7 @@
                 total_bytes += size
         finally:
             del l
-    except (lock.LockHeld, lock.LockUnavailable), inst:
+    except (lock.LockHeld, lock.LockUnavailable):
         raise StreamException(2)
 
     yield '0\n'