mercurial/ui.py
changeset 52640 24ee91ba9aa8
parent 52581 cc918741a22a
child 52644 e627cc25b6f3
equal deleted inserted replaced
52639:9db77d46de79 52640:24ee91ba9aa8
   462     def read_resource_config(
   462     def read_resource_config(
   463         self, name, root=None, trust=False, sections=None, remap=None
   463         self, name, root=None, trust=False, sections=None, remap=None
   464     ) -> None:
   464     ) -> None:
   465         try:
   465         try:
   466             fp = resourceutil.open_resource(name[0], name[1])
   466             fp = resourceutil.open_resource(name[0], name[1])
   467         except IOError:
   467         except OSError:
   468             if not sections:  # ignore unless we were looking for something
   468             if not sections:  # ignore unless we were looking for something
   469                 return
   469                 return
   470             raise
   470             raise
   471 
   471 
   472         self._readconfig(
   472         self._readconfig(
   476     def readconfig(
   476     def readconfig(
   477         self, filename, root=None, trust=False, sections=None, remap=None
   477         self, filename, root=None, trust=False, sections=None, remap=None
   478     ) -> None:
   478     ) -> None:
   479         try:
   479         try:
   480             fp = open(filename, 'rb')
   480             fp = open(filename, 'rb')
   481         except IOError:
   481         except OSError:
   482             if not sections:  # ignore unless we were looking for something
   482             if not sections:  # ignore unless we were looking for something
   483                 return
   483                 return
   484             raise
   484             raise
   485 
   485 
   486         self._readconfig(filename, fp, root, trust, sections, remap)
   486         self._readconfig(filename, fp, root, trust, sections, remap)
  1259             else:
  1259             else:
  1260                 if self._colormode is not None:
  1260                 if self._colormode is not None:
  1261                     label = opts.get('label', b'')
  1261                     label = opts.get('label', b'')
  1262                     msg = self.label(msg, label)
  1262                     msg = self.label(msg, label)
  1263                 dest.write(msg)
  1263                 dest.write(msg)
  1264         except IOError as err:
  1264         except OSError as err:
  1265             raise error.StdioError(err)
  1265             raise error.StdioError(err)
  1266         finally:
  1266         finally:
  1267             self._blockedtimes[b'stdio_blocked'] += (
  1267             self._blockedtimes[b'stdio_blocked'] += (
  1268                 util.timer() - starttime
  1268                 util.timer() - starttime
  1269             ) * 1000
  1269             ) * 1000
  1308                 dest.write(msg)
  1308                 dest.write(msg)
  1309             # stderr may be buffered under win32 when redirected to files,
  1309             # stderr may be buffered under win32 when redirected to files,
  1310             # including stdout.
  1310             # including stdout.
  1311             if dest is self._ferr and not getattr(dest, 'closed', False):
  1311             if dest is self._ferr and not getattr(dest, 'closed', False):
  1312                 dest.flush()
  1312                 dest.flush()
  1313         except IOError as err:
  1313         except OSError as err:
  1314             if dest is self._ferr and err.errno in (
  1314             if dest is self._ferr and err.errno in (
  1315                 errno.EPIPE,
  1315                 errno.EPIPE,
  1316                 errno.EIO,
  1316                 errno.EIO,
  1317                 errno.EBADF,
  1317                 errno.EBADF,
  1318             ):
  1318             ):
  1348         # opencode timeblockedsection because this is a critical path
  1348         # opencode timeblockedsection because this is a critical path
  1349         starttime = util.timer()
  1349         starttime = util.timer()
  1350         try:
  1350         try:
  1351             try:
  1351             try:
  1352                 self._fout.flush()
  1352                 self._fout.flush()
  1353             except IOError as err:
  1353             except OSError as err:
  1354                 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
  1354                 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
  1355                     raise error.StdioError(err)
  1355                     raise error.StdioError(err)
  1356             finally:
  1356             finally:
  1357                 try:
  1357                 try:
  1358                     self._ferr.flush()
  1358                     self._ferr.flush()
  1359                 except IOError as err:
  1359                 except OSError as err:
  1360                     if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
  1360                     if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
  1361                         raise error.StdioError(err)
  1361                         raise error.StdioError(err)
  1362         finally:
  1362         finally:
  1363             self._blockedtimes[b'stdio_blocked'] += (
  1363             self._blockedtimes[b'stdio_blocked'] += (
  1364                 util.timer() - starttime
  1364                 util.timer() - starttime