##// END OF EJS Templates
misc: use modern exception syntax...
FUJIWARA Katsunori -
r28047:863075fd default
parent child Browse files
Show More
@@ -52,7 +52,7 b' def main():'
52 orig_cmd = os.getenv('SSH_ORIGINAL_COMMAND', '?')
52 orig_cmd = os.getenv('SSH_ORIGINAL_COMMAND', '?')
53 try:
53 try:
54 cmdargv = shlex.split(orig_cmd)
54 cmdargv = shlex.split(orig_cmd)
55 except ValueError, e:
55 except ValueError as e:
56 sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
56 sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
57 sys.exit(255)
57 sys.exit(255)
58
58
@@ -47,7 +47,7 b' try:'
47 opts = {}
47 opts = {}
48 try:
48 try:
49 args = fancyopts.fancyopts(sys.argv[1:], options, opts)
49 args = fancyopts.fancyopts(sys.argv[1:], options, opts)
50 except fancyopts.getopt.GetoptError, e:
50 except fancyopts.getopt.GetoptError as e:
51 raise ParseError(e)
51 raise ParseError(e)
52 if opts['help']:
52 if opts['help']:
53 showhelp()
53 showhelp()
@@ -55,11 +55,11 b' try:'
55 if len(args) != 3:
55 if len(args) != 3:
56 raise ParseError(_('wrong number of arguments'))
56 raise ParseError(_('wrong number of arguments'))
57 sys.exit(simplemerge.simplemerge(ui.ui(), *args, **opts))
57 sys.exit(simplemerge.simplemerge(ui.ui(), *args, **opts))
58 except ParseError, e:
58 except ParseError as e:
59 sys.stdout.write("%s: %s\n" % (sys.argv[0], e))
59 sys.stdout.write("%s: %s\n" % (sys.argv[0], e))
60 showhelp()
60 showhelp()
61 sys.exit(1)
61 sys.exit(1)
62 except error.Abort, e:
62 except error.Abort as e:
63 sys.stderr.write("abort: %s\n" % e)
63 sys.stderr.write("abort: %s\n" % e)
64 sys.exit(255)
64 sys.exit(255)
65 except KeyboardInterrupt:
65 except KeyboardInterrupt:
@@ -20,7 +20,7 b' def test_features():'
20 check, _ = feature
20 check, _ = feature
21 try:
21 try:
22 check()
22 check()
23 except Exception, e:
23 except Exception as e:
24 print "feature %s failed: %s" % (name, e)
24 print "feature %s failed: %s" % (name, e)
25 failed += 1
25 failed += 1
26 return failed
26 return failed
@@ -45,7 +45,7 b' def _loadaddon():'
45 sys.path.insert(0, path)
45 sys.path.insert(0, path)
46 try:
46 try:
47 import hghaveaddon
47 import hghaveaddon
48 except BaseException, inst:
48 except BaseException as inst:
49 sys.stderr.write('failed to import hghaveaddon.py from %r: %s\n'
49 sys.stderr.write('failed to import hghaveaddon.py from %r: %s\n'
50 % (path, inst))
50 % (path, inst))
51 sys.exit(2)
51 sys.exit(2)
General Comments 0
You need to be logged in to leave comments. Login now