Patchwork D10583: revlog: use revlog.display_id in format related errors

login
register
mail settings
Submitter phabricator
Date May 3, 2021, 12:07 p.m.
Message ID <differential-rev-PHID-DREV-rba4fi7xjhhdb3ximufk-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48901/
State New
Headers show

Comments

phabricator - May 3, 2021, 12:07 p.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10583

AFFECTED FILES
  mercurial/revlog.py
  tests/test-requires.t
  tests/test-revlog-v2.t
  tests/test-revlog.t

CHANGE DETAILS




To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-revlog.t b/tests/test-revlog.t
--- a/tests/test-revlog.t
+++ b/tests/test-revlog.t
@@ -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 ..
diff --git a/tests/test-revlog-v2.t b/tests/test-revlog-v2.t
--- a/tests/test-revlog-v2.t
+++ b/tests/test-revlog-v2.t
@@ -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 ..
diff --git a/tests/test-requires.t b/tests/test-requires.t
--- a/tests/test-requires.t
+++ b/tests/test-requires.t
@@ -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
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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()