comparison hgext/blackbox.py @ 35667:de598e84c244

py3: cast error message to localstr in blackbox.py According to the exceptions reporting mechanism, this is the #1 crasher in the test harness for Python 3. Since this exception is in an except block, we'll likely get a new #1 crasher after this change. But at least we won't die during error handling! Differential Revision: https://phab.mercurial-scm.org/D1478
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 14 Jan 2018 12:06:27 -0800
parents 375577785f49
children 853bf7d90804
comparison
equal deleted inserted replaced
35666:2c6ebd0c850e 35667:de598e84c244
42 42
43 from mercurial.i18n import _ 43 from mercurial.i18n import _
44 from mercurial.node import hex 44 from mercurial.node import hex
45 45
46 from mercurial import ( 46 from mercurial import (
47 encoding,
47 registrar, 48 registrar,
48 ui as uimod, 49 ui as uimod,
49 util, 50 util,
50 ) 51 )
51 52
180 args = (date, user, rev, changed, pid, src, formattedmsg) 181 args = (date, user, rev, changed, pid, src, formattedmsg)
181 with _openlogfile(ui, vfs) as fp: 182 with _openlogfile(ui, vfs) as fp:
182 fp.write(fmt % args) 183 fp.write(fmt % args)
183 except (IOError, OSError) as err: 184 except (IOError, OSError) as err:
184 self.debug('warning: cannot write to blackbox.log: %s\n' % 185 self.debug('warning: cannot write to blackbox.log: %s\n' %
185 err.strerror) 186 encoding.strtolocal(err.strerror))
186 # do not restore _bbinlog intentionally to avoid failed 187 # do not restore _bbinlog intentionally to avoid failed
187 # logging again 188 # logging again
188 else: 189 else:
189 ui._bbinlog = False 190 ui._bbinlog = False
190 191