revlog: fix error about unknown compression format in py3
In py2, the error is something like:
abort: unknown compression type 'x'!
In py3, we get the following unhelpful message:
abort: unknown compression type <memory at 0x7f4650b5cdc8>!
Switch to something like:
abort: unknown compression type 78!
Differential Revision: https://phab.mercurial-scm.org/D10318
--- a/mercurial/revlog.py Wed Apr 07 12:15:28 2021 +0200
+++ b/mercurial/revlog.py Tue Apr 06 13:49:19 2021 -0400
@@ -13,6 +13,7 @@
from __future__ import absolute_import
+import binascii
import collections
import contextlib
import errno
@@ -2296,7 +2297,9 @@
compressor = engine.revlogcompressor(self._compengineopts)
self._decompressors[t] = compressor
except KeyError:
- raise error.RevlogError(_(b'unknown compression type %r') % t)
+ raise error.RevlogError(
+ _(b'unknown compression type %s') % binascii.hexlify(t)
+ )
return compressor.decompress(data)