[PATCH 6 of 9] misc: use modern exception syntax
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Wed Feb 10 08:58:44 EST 2016
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1455111869 -32400
# Wed Feb 10 22:44:29 2016 +0900
# Node ID 893eef300163d1eda43bd62fe5e5eb1f6fbb3918
# Parent 17ae1dbb1e98f71d5e286f66de7a2216b39362f3
misc: use modern exception syntax
This is fixing for 'legacy exception syntax; use "as" instead of ","'
check-code rule.
check-code has overlooked these, because files aren't recognized as
one to be checked (this problem is fixed by subsequent patch).
diff --git a/contrib/hg-ssh b/contrib/hg-ssh
--- a/contrib/hg-ssh
+++ b/contrib/hg-ssh
@@ -52,7 +52,7 @@ def main():
orig_cmd = os.getenv('SSH_ORIGINAL_COMMAND', '?')
try:
cmdargv = shlex.split(orig_cmd)
- except ValueError, e:
+ except ValueError as e:
sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
sys.exit(255)
diff --git a/contrib/simplemerge b/contrib/simplemerge
--- a/contrib/simplemerge
+++ b/contrib/simplemerge
@@ -47,7 +47,7 @@ try:
opts = {}
try:
args = fancyopts.fancyopts(sys.argv[1:], options, opts)
- except fancyopts.getopt.GetoptError, e:
+ except fancyopts.getopt.GetoptError as e:
raise ParseError(e)
if opts['help']:
showhelp()
@@ -55,11 +55,11 @@ try:
if len(args) != 3:
raise ParseError(_('wrong number of arguments'))
sys.exit(simplemerge.simplemerge(ui.ui(), *args, **opts))
-except ParseError, e:
+except ParseError as e:
sys.stdout.write("%s: %s\n" % (sys.argv[0], e))
showhelp()
sys.exit(1)
-except error.Abort, e:
+except error.Abort as e:
sys.stderr.write("abort: %s\n" % e)
sys.exit(255)
except KeyboardInterrupt:
diff --git a/tests/hghave b/tests/hghave
--- a/tests/hghave
+++ b/tests/hghave
@@ -20,7 +20,7 @@ def test_features():
check, _ = feature
try:
check()
- except Exception, e:
+ except Exception as e:
print "feature %s failed: %s" % (name, e)
failed += 1
return failed
@@ -45,7 +45,7 @@ def _loadaddon():
sys.path.insert(0, path)
try:
import hghaveaddon
- except BaseException, inst:
+ except BaseException as inst:
sys.stderr.write('failed to import hghaveaddon.py from %r: %s\n'
% (path, inst))
sys.exit(2)
More information about the Mercurial-devel
mailing list