diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -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 diff --git a/mercurial/fileset.py b/mercurial/fileset.py --- a/mercurial/fileset.py +++ b/mercurial/fileset.py @@ -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):