changeset 36492:6e90c59b6da1

py3: use pycompat.bytestr() to convert error instances to bytes Differential Revision: https://phab.mercurial-scm.org/D2516
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 01 Mar 2018 23:54:52 +0530
parents 149c5af35de5
children 5b5cc44b2cdc
files mercurial/commands.py mercurial/debugcommands.py
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Mar 01 23:52:30 2018 +0530
+++ b/mercurial/commands.py	Thu Mar 01 23:54:52 2018 +0530
@@ -2370,7 +2370,7 @@
     try:
         regexp = util.re.compile(pattern, reflags)
     except re.error as inst:
-        ui.warn(_("grep: invalid match pattern: %s\n") % inst)
+        ui.warn(_("grep: invalid match pattern: %s\n") % pycompat.bytestr(inst))
         return 1
     sep, eol = ':', '\n'
     if opts.get('print0'):
--- a/mercurial/debugcommands.py	Thu Mar 01 23:52:30 2018 +0530
+++ b/mercurial/debugcommands.py	Thu Mar 01 23:54:52 2018 +0530
@@ -1591,7 +1591,8 @@
                                      metadata=metadata, ui=ui)
                 tr.close()
             except ValueError as exc:
-                raise error.Abort(_('bad obsmarker input: %s') % exc)
+                raise error.Abort(_('bad obsmarker input: %s') %
+                                  pycompat.bytestr(exc))
             finally:
                 tr.release()
         finally: