Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 49534:92892dff03f3
revlog: use the user facing filename as the display_id for filelogs
I had trouble isolating some LFS blob corruption detected by `hg verify` because
the traceback referenced a file, but with the `data/` prefix in the `.hg/store`
path, so it couldn't be located with the `file()` revset:
```
Traceback (most recent call last):
File "/mnt/d/mercurial/mercurial/revlog.py", line 3209, in verifyintegrity
_verify_revision(self, skipflags, state, node)
File "/mnt/d/mercurial/hgext/lfs/wrapper.py", line 246, in _verify_revision
orig(rl, skipflags, state, node)
File "/mnt/d/mercurial/mercurial/revlog.py", line 158, in _verify_revision
rl.revision(node)
File "/mnt/d/mercurial/mercurial/revlog.py", line 1816, in revision
return self._revisiondata(nodeorrev, _df)
File "/mnt/d/mercurial/mercurial/revlog.py", line 1870, in _revisiondata
self.checkhash(text, node, rev=rev)
File "/mnt/d/mercurial/mercurial/revlog.py", line 1996, in checkhash
% (self.display_id, pycompat.bytestr(revornode))
mercurial.error.RevlogError: integrity check failed on data/EXE/PPC/shrinksrec.exe:0
```
(I'm a little surprised it resulted in a stacktrace instead of just a message,
but that's a different issue. I'm also not sure how to trigger the simplestore
case, since IIUC, it's also a revlog based store.)
It's not clear how to handle the changelog and manifest (because the user
doesn't interact with them as a file), so those cases are left alone. The other
thing that would be nice to improve somehow is to indicate that the ":0" is a
revlog revision, not the changeset revision that users are used to. I'm not
sure how to handle the "or node" part though.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 19 Oct 2022 11:50:40 -0400 |
parents | 8d6c8a9a91f8 |
children | 9cac281eb9c0 |
comparison
equal
deleted
inserted
replaced
49533:8d6c8a9a91f8 | 49534:92892dff03f3 |
---|---|
42 FEATURES_BY_VERSION, | 42 FEATURES_BY_VERSION, |
43 FLAG_GENERALDELTA, | 43 FLAG_GENERALDELTA, |
44 FLAG_INLINE_DATA, | 44 FLAG_INLINE_DATA, |
45 INDEX_HEADER, | 45 INDEX_HEADER, |
46 KIND_CHANGELOG, | 46 KIND_CHANGELOG, |
47 KIND_FILELOG, | |
47 RANK_UNKNOWN, | 48 RANK_UNKNOWN, |
48 REVLOGV0, | 49 REVLOGV0, |
49 REVLOGV1, | 50 REVLOGV1, |
50 REVLOGV1_FLAGS, | 51 REVLOGV1_FLAGS, |
51 REVLOGV2, | 52 REVLOGV2, |
650 return self.target[0] | 651 return self.target[0] |
651 | 652 |
652 @util.propertycache | 653 @util.propertycache |
653 def display_id(self): | 654 def display_id(self): |
654 """The public facing "ID" of the revlog that we use in message""" | 655 """The public facing "ID" of the revlog that we use in message""" |
655 # Maybe we should build a user facing representation of | 656 if self.revlog_kind == KIND_FILELOG: |
656 # revlog.target instead of using `self.radix` | 657 # Reference the file without the "data/" prefix, so it is familiar |
657 return self.radix | 658 # to the user. |
659 return self.target[1] | |
660 else: | |
661 return self.radix | |
658 | 662 |
659 def _get_decompressor(self, t): | 663 def _get_decompressor(self, t): |
660 try: | 664 try: |
661 compressor = self._decompressors[t] | 665 compressor = self._decompressors[t] |
662 except KeyError: | 666 except KeyError: |