# HG changeset patch # User twaldmann@thinkmo.de # Date 1131933575 -7200 # Node ID bf4e7ef08741aca674757905602396767f9eba0c # Parent 8ca9f5b1725743e981cb66a6ae685a52ea4e58f1 fixed some stuff pychecker shows, marked unclear/wrong stuff with XXX diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -644,7 +644,7 @@ def cat(ui, repo, file1, *pats, **opts): 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 @@ def debugrename(ui, repo, file, rev=None 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 @@ def dispatch(args): 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:]: diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -213,7 +213,7 @@ class dirstate: 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 @@ class dirstate: def walkhelper(self, files, statmatch, dc): # recursion free walker, faster than os.walk. def findfiles(s): - retfiles = [] work = [s] while work: top = work.pop() diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py --- a/mercurial/fancyopts.py +++ b/mercurial/fancyopts.py @@ -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('-', '_') diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -58,7 +58,7 @@ class filelog(revlog): 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"): diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py --- a/mercurial/hgweb.py +++ b/mercurial/hgweb.py @@ -954,7 +954,7 @@ def create_server(repo): 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 diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -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 * diff --git a/mercurial/node.py b/mercurial/node.py --- a/mercurial/node.py +++ b/mercurial/node.py @@ -7,7 +7,7 @@ This software may be used and distribute of the GNU General Public License, incorporated herein by reference. """ -import sha, binascii +import binascii nullid = "\0" * 20 diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -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: diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -158,9 +158,11 @@ def pathto(n1, n2): 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 @@ def _matcher(canonroot, cwd, names, inc, 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):