changeset 46689:8408c3198ec1 stable

debug: convert a few exceptions to bytes before wrapping in another error Caught by pytype: File "/mnt/c/Users/Matt/hg/mercurial/debugcommands.py", line 2118, in debugmanifestfulltextcache: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types] Expected: (self, message: Union[bytearray, bytes, memoryview], ...) Actually passed: (self, message: mercurial.error.LookupError, ...) File "/mnt/c/Users/Matt/hg/mercurial/debugcommands.py", line 2453, in debugobsolete: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types] Expected: (self, ints: Iterable[int]) Actually passed: (self, ints: ValueError) The following methods aren't implemented on ValueError: __iter__ Differential Revision: https://phab.mercurial-scm.org/D10174
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 11 Mar 2021 17:27:31 -0500
parents 7e02e7c721b0
children 90a92f041fc6
files mercurial/debugcommands.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Thu Mar 11 17:16:29 2021 -0500
+++ b/mercurial/debugcommands.py	Thu Mar 11 17:27:31 2021 -0500
@@ -2041,7 +2041,9 @@
                 try:
                     manifest = m[store.lookup(n)]
                 except error.LookupError as e:
-                    raise error.Abort(e, hint=b"Check your manifest node id")
+                    raise error.Abort(
+                        bytes(e), hint=b"Check your manifest node id"
+                    )
                 manifest.read()  # stores revisision in cache too
             return
 
@@ -2376,7 +2378,7 @@
                 tr.close()
             except ValueError as exc:
                 raise error.Abort(
-                    _(b'bad obsmarker input: %s') % pycompat.bytestr(exc)
+                    _(b'bad obsmarker input: %s') % stringutil.forcebytestr(exc)
                 )
             finally:
                 tr.release()