comparison mercurial/debugcommands.py @ 46396: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 bc884e31b8c8
children 521ac0d7047f
comparison
equal deleted inserted replaced
46395:7e02e7c721b0 46396:8408c3198ec1
2039 store = m.getstorage(b'') 2039 store = m.getstorage(b'')
2040 for n in add: 2040 for n in add:
2041 try: 2041 try:
2042 manifest = m[store.lookup(n)] 2042 manifest = m[store.lookup(n)]
2043 except error.LookupError as e: 2043 except error.LookupError as e:
2044 raise error.Abort(e, hint=b"Check your manifest node id") 2044 raise error.Abort(
2045 bytes(e), hint=b"Check your manifest node id"
2046 )
2045 manifest.read() # stores revisision in cache too 2047 manifest.read() # stores revisision in cache too
2046 return 2048 return
2047 2049
2048 cache = getcache() 2050 cache = getcache()
2049 if not len(cache): 2051 if not len(cache):
2374 ui=ui, 2376 ui=ui,
2375 ) 2377 )
2376 tr.close() 2378 tr.close()
2377 except ValueError as exc: 2379 except ValueError as exc:
2378 raise error.Abort( 2380 raise error.Abort(
2379 _(b'bad obsmarker input: %s') % pycompat.bytestr(exc) 2381 _(b'bad obsmarker input: %s') % stringutil.forcebytestr(exc)
2380 ) 2382 )
2381 finally: 2383 finally:
2382 tr.release() 2384 tr.release()
2383 finally: 2385 finally:
2384 l.release() 2386 l.release()