fixed some stuff pychecker shows, marked unclear/wrong stuff with XXX
authortwaldmann@thinkmo.de
Mon, 14 Nov 2005 03:59:35 +0200
changeset 1541 bf4e7ef08741
parent 1540 8ca9f5b17257
child 1542 8e80eefb3de6
fixed some stuff pychecker shows, marked unclear/wrong stuff with XXX
mercurial/commands.py
mercurial/dirstate.py
mercurial/fancyopts.py
mercurial/filelog.py
mercurial/hgweb.py
mercurial/manifest.py
mercurial/node.py
mercurial/transaction.py
mercurial/util.py
--- a/mercurial/commands.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/commands.py	Mon Nov 14 03:59:35 2005 +0200
@@ -644,7 +644,7 @@
                 n = mf[abs]
             except (hg.RepoError, KeyError):
                 try:
-                    n = r.lookup(rev)
+                    n = r.lookup(rev) # XXX rev undefined!
                 except KeyError, inst:
                     raise util.Abort(_('cannot find file %s in rev %s'), rel, rev)
         else:
@@ -1016,7 +1016,7 @@
             change = repo.changelog.read(n)
             m = repo.manifest.read(change[0])
             n = m[relpath(repo, [file])[0]]
-        except hg.RepoError, KeyError:
+        except (hg.RepoError, KeyError):
             n = r.lookup(rev)
     else:
         n = r.tip()
@@ -2470,7 +2470,7 @@
 
     external = []
     for x in u.extensions():
-        def on_exception(Exception, inst):
+        def on_exception(Exception, inst): # XXX Exception is a builtin name!?
             u.warn(_("*** failed to import extension %s\n") % x[1])
             u.warn("%s\n" % inst)
             if "--traceback" in sys.argv[1:]:
--- a/mercurial/dirstate.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/dirstate.py	Mon Nov 14 03:59:35 2005 +0200
@@ -213,7 +213,7 @@
         unknown = []
 
         for x in files:
-            if x is '.':
+            if x == '.':
                 return self.map.copy()
             if x not in self.map:
                 unknown.append(x)
@@ -296,7 +296,6 @@
     def walkhelper(self, files, statmatch, dc):
         # recursion free walker, faster than os.walk.
         def findfiles(s):
-            retfiles = []
             work = [s]
             while work:
                 top = work.pop()
--- a/mercurial/fancyopts.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/fancyopts.py	Mon Nov 14 03:59:35 2005 +0200
@@ -1,10 +1,10 @@
 import getopt
 
 def fancyopts(args, options, state):
-    long=[]
-    short=''
-    map={}
-    dt={}
+    long = []
+    short = ''
+    map = {}
+    dt = {}
 
     for s, l, d, c in options:
         pl = l.replace('-', '_')
--- a/mercurial/filelog.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/filelog.py	Mon Nov 14 03:59:35 2005 +0200
@@ -58,7 +58,7 @@
         return self.addrevision(text, transaction, link, p1, p2)
 
     def renamed(self, node):
-        if 0 and self.parents(node)[0] != nullid:
+        if 0 and self.parents(node)[0] != nullid: # XXX
             return False
         m = self.readmeta(node)
         if m and m.has_key("copy"):
--- a/mercurial/hgweb.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/hgweb.py	Mon Nov 14 03:59:35 2005 +0200
@@ -954,7 +954,7 @@
 def server(path, name, templates, address, port, use_ipv6=False,
            accesslog=sys.stdout, errorlog=sys.stderr):
     httpd = create_server(path, name, templates, address, port, use_ipv6,
-                          accesslog, errorlog)
+                          accesslog, errorlog) # XXX wrong param count
     httpd.serve_forever()
 
 # This is a stopgap
--- a/mercurial/manifest.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/manifest.py	Mon Nov 14 03:59:35 2005 +0200
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import sys, struct
+import struct
 from revlog import *
 from i18n import gettext as _
 from demandload import *
--- a/mercurial/node.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/node.py	Mon Nov 14 03:59:35 2005 +0200
@@ -7,7 +7,7 @@
 of the GNU General Public License, incorporated herein by reference.
 """
 
-import sha, binascii
+import binascii
 
 nullid = "\0" * 20
 
--- a/mercurial/transaction.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/transaction.py	Mon Nov 14 03:59:35 2005 +0200
@@ -12,7 +12,6 @@
 # of the GNU General Public License, incorporated herein by reference.
 
 import os
-import util
 from i18n import gettext as _
 
 class transaction:
--- a/mercurial/util.py	Mon Nov 14 02:30:19 2005 +0200
+++ b/mercurial/util.py	Mon Nov 14 03:59:35 2005 +0200
@@ -158,9 +158,11 @@
     this returns a path in the form used by the local filesystem, not hg.'''
     if not n1: return localpath(n2)
     a, b = n1.split('/'), n2.split('/')
-    a.reverse(), b.reverse()
+    a.reverse()
+    b.reverse()
     while a and b and a[-1] == b[-1]:
-        a.pop(), b.pop()
+        a.pop()
+        b.pop()
     b.reverse()
     return os.sep.join((['..'] * len(a)) + b)
 
@@ -253,7 +255,7 @@
             try:
                 pat = '(?:%s)' % regex(k, p, tail)
                 matches.append(re.compile(pat).match)
-            except re.error, inst:
+            except re.error:
                 raise Abort("invalid pattern: %s:%s" % (k, p))
 
         def buildfn(text):