changeset 46852:fbfb1d6d8459

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
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Tue, 06 Apr 2021 13:49:19 -0400
parents 3aa78f2aea48
children eed3e2b79b48
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)