cleanup: replace naked excepts with except Exception: ...
--- a/contrib/perf.py Sat May 12 16:02:45 2012 +0200
+++ b/contrib/perf.py Sat May 12 16:02:46 2012 +0200
@@ -33,11 +33,11 @@
try:
m = scmutil.match(repo[None], pats, {})
timer(lambda: len(list(repo.dirstate.walk(m, [], True, False))))
- except:
+ except Exception:
try:
m = scmutil.match(repo[None], pats, {})
timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)]))
- except:
+ except Exception:
timer(lambda: len(list(cmdutil.walk(repo, pats, {}))))
def perfstatus(ui, repo, *pats):
--- a/contrib/setup3k.py Sat May 12 16:02:45 2012 +0200
+++ b/contrib/setup3k.py Sat May 12 16:02:46 2012 +0200
@@ -84,7 +84,7 @@
os.dup2(devnull.fileno(), sys.stderr.fileno())
objects = cc.compile([fname], output_dir=tmpdir)
cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
- except:
+ except Exception:
return False
return True
finally:
--- a/hgext/convert/bzr.py Sat May 12 16:02:45 2012 +0200
+++ b/hgext/convert/bzr.py Sat May 12 16:02:46 2012 +0200
@@ -72,7 +72,7 @@
self.ui.warn(_('warning: lightweight checkouts may cause '
'conversion failures, try with a regular '
'branch instead.\n'))
- except:
+ except Exception:
self.ui.note(_('bzr source type could not be determined\n'))
def before(self):
--- a/hgext/convert/convcmd.py Sat May 12 16:02:45 2012 +0200
+++ b/hgext/convert/convcmd.py Sat May 12 16:02:46 2012 +0200
@@ -462,7 +462,7 @@
if not revmapfile:
try:
revmapfile = destc.revmapfile()
- except:
+ except Exception:
revmapfile = os.path.join(destc, "map")
c = converter(ui, srcc, destc, revmapfile, opts)
--- a/hgext/convert/git.py Sat May 12 16:02:45 2012 +0200
+++ b/hgext/convert/git.py Sat May 12 16:02:46 2012 +0200
@@ -211,7 +211,7 @@
continue
name = '%s%s' % (reftype, name[prefixlen:])
bookmarks[name] = rev
- except:
+ except Exception:
pass
return bookmarks
--- a/hgext/convert/hg.py Sat May 12 16:02:45 2012 +0200
+++ b/hgext/convert/hg.py Sat May 12 16:02:46 2012 +0200
@@ -95,7 +95,7 @@
self.after()
try:
self.repo = hg.repository(self.ui, branchpath)
- except:
+ except Exception:
self.repo = hg.repository(self.ui, branchpath, create=True)
self.before()
@@ -105,7 +105,7 @@
for b in pbranches:
try:
self.repo.lookup(b[0])
- except:
+ except Exception:
missings.setdefault(b[1], []).append(b[0])
if missings:
@@ -192,7 +192,7 @@
try:
oldlines = sorted(parentctx['.hgtags'].data().splitlines(True))
- except:
+ except Exception:
oldlines = []
newlines = sorted([("%s %s\n" % (tags[tag], tag)) for tag in tags])
--- a/hgext/convert/monotone.py Sat May 12 16:02:45 2012 +0200
+++ b/hgext/convert/monotone.py Sat May 12 16:02:46 2012 +0200
@@ -286,7 +286,7 @@
raise IOError # file was deleted or renamed
try:
data = self.mtnrun("get_file_of", name, r=rev)
- except:
+ except Exception:
raise IOError # file was deleted or renamed
self.mtnloadmanifest(rev)
node, attr = self.files.get(name, (None, ""))
--- a/hgext/convert/subversion.py Sat May 12 16:02:45 2012 +0200
+++ b/hgext/convert/subversion.py Sat May 12 16:02:46 2012 +0200
@@ -176,7 +176,7 @@
'know better.\n'))
return True
data = inst.fp.read()
- except:
+ except Exception:
# Could be urllib2.URLError if the URL is invalid or anything else.
return False
return '<m:human-readable errcode="160013">' in data
--- a/hgext/mq.py Sat May 12 16:02:45 2012 +0200
+++ b/hgext/mq.py Sat May 12 16:02:46 2012 +0200
@@ -613,7 +613,7 @@
raise util.Abort(_("repo commit failed"))
try:
ph = patchheader(mergeq.join(patch), self.plainmode)
- except:
+ except Exception:
raise util.Abort(_("unable to read %s") % patch)
diffopts = self.patchopts(diffopts, patch)
--- a/mercurial/commands.py Sat May 12 16:02:45 2012 +0200
+++ b/mercurial/commands.py Sat May 12 16:02:46 2012 +0200
@@ -1917,7 +1917,7 @@
if format == 0:
try:
pp = r.parents(node)
- except:
+ except Exception:
pp = [nullid, nullid]
ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
i, r.start(i), r.length(i), base, r.linkrev(i),
--- a/mercurial/transaction.py Sat May 12 16:02:45 2012 +0200
+++ b/mercurial/transaction.py Sat May 12 16:02:46 2012 +0200
@@ -164,7 +164,7 @@
_playback(self.journal, self.report, self.opener,
self.entries, False)
self.report(_("rollback completed\n"))
- except:
+ except Exception:
self.report(_("rollback failed - please run hg recover\n"))
finally:
self.journal = None
--- a/mercurial/verify.py Sat May 12 16:02:45 2012 +0200
+++ b/mercurial/verify.py Sat May 12 16:02:46 2012 +0200
@@ -87,7 +87,7 @@
# attempt to filter down to real linkrevs
linkrevs = [l for l in linkrevs
if lrugetctx(l)[f].filenode() == node]
- except:
+ except Exception:
pass
warn(_(" (expected %s)") % " ".join(map(str, linkrevs)))
lr = None # can't be trusted
@@ -189,7 +189,7 @@
try:
fl = repo.file(f)
lr = min([fl.linkrev(fl.rev(n)) for n in filenodes[f]])
- except:
+ except Exception:
lr = None
err(lr, _("in manifest but not in changeset"), f)
--- a/setup.py Sat May 12 16:02:45 2012 +0200
+++ b/setup.py Sat May 12 16:02:46 2012 +0200
@@ -108,7 +108,7 @@
os.dup2(devnull.fileno(), sys.stderr.fileno())
objects = cc.compile([fname], output_dir=tmpdir)
cc.link_executable(objects, os.path.join(tmpdir, "a.out"))
- except:
+ except Exception:
return False
return True
finally:
--- a/tests/test-check-code-hg.t Sat May 12 16:02:45 2012 +0200
+++ b/tests/test-check-code-hg.t Sat May 12 16:02:46 2012 +0200
@@ -8,24 +8,9 @@
$ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
$ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0 || true
- contrib/perf.py:0:
- > except:
- warning: naked except clause
- contrib/perf.py:0:
- > except:
- warning: naked except clause
- contrib/setup3k.py:0:
- > except:
- warning: naked except clause
contrib/shrink-revlog.py:0:
> except:
warning: naked except clause
- hgext/convert/bzr.py:0:
- > except:
- warning: naked except clause
- hgext/convert/convcmd.py:0:
- > except:
- warning: naked except clause
hgext/convert/cvsps.py:0:
> ui.write('Ancestors: %s\n' % (','.join(r)))
warning: unwrapped ui message
@@ -59,22 +44,6 @@
hgext/convert/cvsps.py:0:
> ui.write('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1],
warning: unwrapped ui message
- hgext/convert/git.py:0:
- > except:
- warning: naked except clause
- hgext/convert/hg.py:0:
- > except:
- warning: naked except clause
- warning: naked except clause
- hgext/convert/hg.py:0:
- > except:
- warning: naked except clause
- hgext/convert/monotone.py:0:
- > except:
- warning: naked except clause
- hgext/convert/subversion.py:0:
- > except:
- warning: naked except clause
hgext/hgk.py:0:
> ui.write("parent %s\n" % p)
warning: unwrapped ui message
@@ -109,9 +78,6 @@
warning: naked except clause
warning: naked except clause
hgext/mq.py:0:
- > except:
- warning: naked except clause
- hgext/mq.py:0:
> ui.write("mq: %s\n" % ', '.join(m))
warning: unwrapped ui message
hgext/patchbomb.py:0:
@@ -133,9 +99,6 @@
> ui.write("unpruned common: %s\n" % " ".join([short(n)
warning: unwrapped ui message
mercurial/commands.py:0:
- > except:
- warning: naked except clause
- mercurial/commands.py:0:
> ui.write("format: id, p1, p2, cset, delta base, len(delta)\n")
warning: unwrapped ui message
mercurial/commands.py:0:
@@ -238,21 +201,9 @@
mercurial/repair.py:0:
> except:
warning: naked except clause
- mercurial/transaction.py:0:
- > except:
- warning: naked except clause
mercurial/util.py:0:
> except:
warning: naked except clause
- mercurial/verify.py:0:
- > except:
- warning: naked except clause
- mercurial/verify.py:0:
- > except:
- warning: naked except clause
- setup.py:0:
- > except:
- warning: naked except clause
tests/autodiff.py:0:
> ui.write('data lost for: %s\n' % fn)
warning: unwrapped ui message