diff mercurial/bundle2.py @ 25660:328739ea70c3

global: mass rewrite to use modern exception syntax Python 2.6 introduced the "except type as instance" syntax, replacing the "except type, instance" syntax that came before. Python 3 dropped support for the latter syntax. Since we no longer support Python 2.4 or 2.5, we have no need to continue supporting the "except type, instance". This patch mass rewrites the exception syntax to be Python 2.6+ and Python 3 compatible. This patch was produced by running `2to3 -f except -w -n .`.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 23 Jun 2015 22:20:08 -0700
parents c0bdfe87b245
children 8221fefaea08
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue Jun 23 22:38:21 2015 -0700
+++ b/mercurial/bundle2.py	Tue Jun 23 22:20:08 2015 -0700
@@ -336,7 +336,7 @@
     try:
         for nbpart, part in iterparts:
             _processpart(op, part)
-    except BaseException, exc:
+    except BaseException as exc:
         for nbpart, part in iterparts:
             # consume the bundle content
             part.seek(0, 2)
@@ -380,7 +380,7 @@
                 raise error.UnsupportedPartError(parttype=part.type,
                                                params=unknownparams)
             status = 'supported'
-        except error.UnsupportedPartError, exc:
+        except error.UnsupportedPartError as exc:
             if part.mandatory: # mandatory parts
                 raise
             indebug(op.ui, 'ignoring unsupported advisory part %s' % exc)
@@ -585,7 +585,7 @@
         if self._seekable:
             try:
                 return self._fp.tell()
-            except IOError, e:
+            except IOError as e:
                 if e.errno == errno.ESPIPE:
                     self._seekable = False
                 else:
@@ -841,7 +841,7 @@
                 outdebug(ui, 'payload chunk size: %i' % len(chunk))
                 yield _pack(_fpayloadsize, len(chunk))
                 yield chunk
-        except BaseException, exc:
+        except BaseException as exc:
             # backup exception data for later
             ui.debug('bundle2-input-stream-interrupt: encoding exception %s'
                      % exc)
@@ -1248,7 +1248,7 @@
         part.addparam('return', '%i' % ret, mandatory=False)
     try:
         real_part.validate()
-    except util.Abort, e:
+    except util.Abort as e:
         raise util.Abort(_('bundle at %s is corrupted:\n%s') %
             (util.hidepassword(raw_url), str(e)))
     assert not inpart.read()