D10131: localrepo: fix conversion of exceptions to strings flagged by pytype

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Mon Mar 8 23:45:06 UTC 2021


mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the same as e571fec5b606 <https://phab.mercurial-scm.org/rHGe571fec5b606667d062b7822589879a08324a1a8>.  I assume the 3 similar uses of `bytestr` in
  `__getitem__()` are OK (even though pytype also flags them), because there is
  apparently test coverage for 2 of the 3 cases.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -540,7 +540,7 @@
         except ValueError as e:
             # Can be raised on Python 3.8 when path is invalid.
             raise error.Abort(
-                _(b'invalid path %s: %s') % (path, pycompat.bytestr(e))
+                _(b'invalid path %s: %s') % (path, stringutil.forcebytestr(e))
             )
 
         raise error.RepoError(_(b'repository %s not found') % path)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list