py3: use utils.stringutil.forcebytestr to convert error to bytes
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 19 May 2018 18:48:26 +0530
changeset 38083 5f2dc1b71cf1
parent 38082 1978abdb216c
child 38084 86e0a4bede5d
py3: use utils.stringutil.forcebytestr to convert error to bytes Differential Revision: https://phab.mercurial-scm.org/D3607
hgext/infinitepush/__init__.py
mercurial/fileset.py
--- a/hgext/infinitepush/__init__.py	Sat May 19 18:47:20 2018 +0530
+++ b/hgext/infinitepush/__init__.py	Sat May 19 18:48:26 2018 +0530
@@ -576,7 +576,7 @@
                 if repo.bundlestore.index.getbundle(localkey):
                     return "%d %s\n" % (1, localkey)
                 else:
-                    r = str(inst)
+                    r = stringutil.forcebytestr(inst)
                     return "%d %s\n" % (0, r)
     return _lookup
 
--- a/mercurial/fileset.py	Sat May 19 18:47:20 2018 +0530
+++ b/mercurial/fileset.py	Sat May 19 18:48:26 2018 +0530
@@ -354,7 +354,8 @@
         # i18n: "grep" is a keyword
         r = re.compile(getstring(x, _("grep requires a pattern")))
     except re.error as e:
-        raise error.ParseError(_('invalid match pattern: %s') % e)
+        raise error.ParseError(_('invalid match pattern: %s') %
+                               stringutil.forcebytestr(e))
     return [f for f in mctx.existing() if r.search(mctx.ctx[f].data())]
 
 def _sizetomax(s):