D3607: py3: use utils.stringutil.forcebytestr to convert error to bytes

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat May 19 10:39:58 EDT 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3607

AFFECTED FILES
  hgext/infinitepush/__init__.py
  mercurial/fileset.py

CHANGE DETAILS

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):
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
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list