comparison mercurial/context.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 70ac1868b707
children 24cda1dd45ff
comparison
equal deleted inserted replaced
25659:d60678a567a9 25660:328739ea70c3
1436 wlock.release() 1436 wlock.release()
1437 1437
1438 def copy(self, source, dest): 1438 def copy(self, source, dest):
1439 try: 1439 try:
1440 st = self._repo.wvfs.lstat(dest) 1440 st = self._repo.wvfs.lstat(dest)
1441 except OSError, err: 1441 except OSError as err:
1442 if err.errno != errno.ENOENT: 1442 if err.errno != errno.ENOENT:
1443 raise 1443 raise
1444 self._repo.ui.warn(_("%s does not exist!\n") % dest) 1444 self._repo.ui.warn(_("%s does not exist!\n") % dest)
1445 return 1445 return
1446 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): 1446 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1682 return self._repo.wvfs.lstat(self._path).st_size 1682 return self._repo.wvfs.lstat(self._path).st_size
1683 def date(self): 1683 def date(self):
1684 t, tz = self._changectx.date() 1684 t, tz = self._changectx.date()
1685 try: 1685 try:
1686 return (int(self._repo.wvfs.lstat(self._path).st_mtime), tz) 1686 return (int(self._repo.wvfs.lstat(self._path).st_mtime), tz)
1687 except OSError, err: 1687 except OSError as err:
1688 if err.errno != errno.ENOENT: 1688 if err.errno != errno.ENOENT:
1689 raise 1689 raise
1690 return (t, tz) 1690 return (t, tz)
1691 1691
1692 def cmp(self, fctx): 1692 def cmp(self, fctx):