changeset 47157:3a9f3470922c

revlog: use revlog.display_id in format related errors Differential Revision: https://phab.mercurial-scm.org/D10583
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:23:48 +0200
parents 89e11a6da785
children e1936ae27897
files mercurial/revlog.py tests/test-requires.t tests/test-revlog-v2.t tests/test-revlog.t
diffstat 4 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon May 03 12:23:37 2021 +0200
+++ b/mercurial/revlog.py	Mon May 03 12:23:48 2021 +0200
@@ -490,7 +490,7 @@
             if flags:
                 raise error.RevlogError(
                     _(b'unknown flags (%#04x) in version %d revlog %s')
-                    % (flags >> 16, fmt, self._indexfile)
+                    % (flags >> 16, fmt, self.display_id)
                 )
 
             self._inline = False
@@ -500,7 +500,7 @@
             if flags & ~REVLOGV1_FLAGS:
                 raise error.RevlogError(
                     _(b'unknown flags (%#04x) in version %d revlog %s')
-                    % (flags >> 16, fmt, self._indexfile)
+                    % (flags >> 16, fmt, self.display_id)
                 )
 
             self._inline = versionflags & FLAG_INLINE_DATA
@@ -510,7 +510,7 @@
             if flags & ~REVLOGV2_FLAGS:
                 raise error.RevlogError(
                     _(b'unknown flags (%#04x) in version %d revlog %s')
-                    % (flags >> 16, fmt, self._indexfile)
+                    % (flags >> 16, fmt, self.display_id)
                 )
 
             # There is a bug in the transaction handling when going from an
@@ -523,7 +523,7 @@
 
         else:
             raise error.RevlogError(
-                _(b'unknown version (%d) in revlog %s') % (fmt, self._indexfile)
+                _(b'unknown version (%d) in revlog %s') % (fmt, self.display_id)
             )
 
         self.nodeconstants = sha1nodeconstants
@@ -2990,7 +2990,7 @@
         if version != state[b'expectedversion']:
             yield revlogproblem(
                 warning=_(b"warning: '%s' uses revlog format %d; expected %d")
-                % (self._indexfile, version, state[b'expectedversion'])
+                % (self.display_id, version, state[b'expectedversion'])
             )
 
         state[b'skipread'] = set()
--- a/tests/test-requires.t	Mon May 03 12:23:37 2021 +0200
+++ b/tests/test-requires.t	Mon May 03 12:23:48 2021 +0200
@@ -5,7 +5,7 @@
   $ hg commit -m test
   $ rm .hg/requires
   $ hg tip
-  abort: unknown version (65535) in revlog 00changelog.i
+  abort: unknown version (65535) in revlog 00changelog
   [50]
   $ echo indoor-pool > .hg/requires
   $ hg tip
--- a/tests/test-revlog-v2.t	Mon May 03 12:23:37 2021 +0200
+++ b/tests/test-revlog-v2.t	Mon May 03 12:23:48 2021 +0200
@@ -37,7 +37,7 @@
   ...     fh.write(b'\xff\x00\xde\xad') and None
 
   $ hg log
-  abort: unknown flags (0xff00) in version 57005 revlog 00changelog.i
+  abort: unknown flags (0xff00) in version 57005 revlog 00changelog
   [50]
 
   $ cd ..
--- a/tests/test-revlog.t	Mon May 03 12:23:37 2021 +0200
+++ b/tests/test-revlog.t	Mon May 03 12:23:48 2021 +0200
@@ -7,7 +7,7 @@
   ...     fh.write(b'\x00\x01\x00\x00') and None
 
   $ hg log
-  abort: unknown flags (0x01) in version 0 revlog 00changelog.i
+  abort: unknown flags (0x01) in version 0 revlog 00changelog
   [50]
 
 Unknown flags on revlog version 1 are rejected
@@ -16,7 +16,7 @@
   ...     fh.write(b'\x00\x04\x00\x01') and None
 
   $ hg log
-  abort: unknown flags (0x04) in version 1 revlog 00changelog.i
+  abort: unknown flags (0x04) in version 1 revlog 00changelog
   [50]
 
 Unknown version is rejected
@@ -25,7 +25,7 @@
   ...     fh.write(b'\x00\x00\xbe\xef') and None
 
   $ hg log
-  abort: unknown version (48879) in revlog 00changelog.i
+  abort: unknown version (48879) in revlog 00changelog
   [50]
 
   $ cd ..