mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-06-28 20:17:26 +00:00
Use modern Python exception syntax
"except Exception as e" instead of "except Exception, e" This is part of a transition to supporting Python 3. Python >= 2.6 support "as" syntax. Note: this removes Python 2.5 support. Change-Id: I309599f3981bba2b46111c43102bee38ff132803
This commit is contained in:
10
main.py
10
main.py
@ -146,13 +146,13 @@ class _Repo(object):
|
||||
else:
|
||||
print >>sys.stderr, 'real\t%dh%dm%.3fs' \
|
||||
% (hours, minutes, seconds)
|
||||
except DownloadError, e:
|
||||
except DownloadError as e:
|
||||
print >>sys.stderr, 'error: %s' % str(e)
|
||||
return 1
|
||||
except ManifestInvalidRevisionError, e:
|
||||
except ManifestInvalidRevisionError as e:
|
||||
print >>sys.stderr, 'error: %s' % str(e)
|
||||
return 1
|
||||
except NoSuchProjectError, e:
|
||||
except NoSuchProjectError as e:
|
||||
if e.name:
|
||||
print >>sys.stderr, 'error: project %s not found' % e.name
|
||||
else:
|
||||
@ -390,14 +390,14 @@ def _Main(argv):
|
||||
close_ssh()
|
||||
except KeyboardInterrupt:
|
||||
result = 1
|
||||
except RepoChangedException, rce:
|
||||
except RepoChangedException as rce:
|
||||
# If repo changed, re-exec ourselves.
|
||||
#
|
||||
argv = list(sys.argv)
|
||||
argv.extend(rce.extra_args)
|
||||
try:
|
||||
os.execv(__file__, argv)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
print >>sys.stderr, 'fatal: cannot restart repo after upgrade'
|
||||
print >>sys.stderr, 'fatal: %s' % e
|
||||
result = 128
|
||||
|
Reference in New Issue
Block a user