##// END OF EJS Templates
verify: allow the storage to signal when renames can be tested on `skipread`...
Matt Harbison -
r44530:b9e174d4 default
parent child Browse files
Show More
@@ -236,6 +236,10 b' def _verify_revision(orig, rl, skipflags'
236 # the revlog.
236 # the revlog.
237 if rl.opener.lfslocalblobstore.has(metadata.oid()):
237 if rl.opener.lfslocalblobstore.has(metadata.oid()):
238 skipflags &= ~revlog.REVIDX_EXTSTORED
238 skipflags &= ~revlog.REVIDX_EXTSTORED
239 elif skipflags & revlog.REVIDX_EXTSTORED:
240 # The wrapped method will set `skipread`, but there's enough local
241 # info to check renames.
242 state[b'safe_renamed'].add(node)
239
243
240 orig(rl, skipflags, state, node)
244 orig(rl, skipflags, state, node)
241
245
@@ -878,7 +878,9 b' class ifilestorage(ifileindex, ifiledata'
878
878
879 If individual revisions cannot have their revision content resolved,
879 If individual revisions cannot have their revision content resolved,
880 the method is expected to set the ``skipread`` key to a set of nodes
880 the method is expected to set the ``skipread`` key to a set of nodes
881 that encountered problems.
881 that encountered problems. If set, the method can also add the node(s)
882 to ``safe_renamed`` in order to indicate nodes that may perform the
883 rename checks with currently accessible data.
882
884
883 The method yields objects conforming to the ``iverifyproblem``
885 The method yields objects conforming to the ``iverifyproblem``
884 interface.
886 interface.
@@ -2874,6 +2874,7 b' class revlog(object):'
2874 )
2874 )
2875
2875
2876 state[b'skipread'] = set()
2876 state[b'skipread'] = set()
2877 state[b'safe_renamed'] = set()
2877
2878
2878 for rev in self:
2879 for rev in self:
2879 node = self.node(rev)
2880 node = self.node(rev)
@@ -529,6 +529,8 b' class verifier(object):'
529 else:
529 else:
530 # Guard against implementations not setting this.
530 # Guard against implementations not setting this.
531 state[b'skipread'] = set()
531 state[b'skipread'] = set()
532 state[b'safe_renamed'] = set()
533
532 for problem in fl.verifyintegrity(state):
534 for problem in fl.verifyintegrity(state):
533 if problem.node is not None:
535 if problem.node is not None:
534 linkrev = fl.linkrev(fl.rev(problem.node))
536 linkrev = fl.linkrev(fl.rev(problem.node))
@@ -560,7 +562,7 b' class verifier(object):'
560 else:
562 else:
561 del filenodes[f][n]
563 del filenodes[f][n]
562
564
563 if n in state[b'skipread']:
565 if n in state[b'skipread'] and n not in state[b'safe_renamed']:
564 continue
566 continue
565
567
566 # check renames
568 # check renames
@@ -218,6 +218,15 b' enabled adds the lfs requirement'
218 R large
218 R large
219 $ hg commit -m 'renames'
219 $ hg commit -m 'renames'
220
220
221 $ hg cat -r . l -T '{rawdata}\n'
222 version https://git-lfs.github.com/spec/v1
223 oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
224 size 39
225 x-hg-copy large
226 x-hg-copyrev 2c531e0992ff3107c511b53cb82a91b6436de8b2
227 x-is-binary 0
228
229
221 $ hg files -r . 'set:copied()'
230 $ hg files -r . 'set:copied()'
222 l
231 l
223 s
232 s
@@ -796,27 +805,57 b" because they aren't accessed."
796 $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
805 $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
797 [1]
806 [1]
798
807
799 Verify will not try to download lfs blobs, if told not to process lfs content
808 Verify will not try to download lfs blobs, if told not to process lfs content.
809 The extension makes sure that the filelog.renamed() path is taken on a missing
810 blob, and the output shows that it isn't fetched.
800
811
801 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v --no-lfs
812 $ cat > $TESTTMP/lfsrename.py <<EOF
813 > from mercurial import (
814 > exthelper,
815 > )
816 >
817 > from hgext.lfs import (
818 > pointer,
819 > wrapper,
820 > )
821 >
822 > eh = exthelper.exthelper()
823 > uisetup = eh.finaluisetup
824 >
825 > @eh.wrapfunction(wrapper, b'filelogrenamed')
826 > def filelogrenamed(orig, orig1, self, node):
827 > ret = orig(orig1, self, node)
828 > if wrapper._islfs(self._revlog, node) and ret:
829 > rawtext = self._revlog.rawdata(node)
830 > metadata = pointer.deserialize(rawtext)
831 > print('lfs blob %s renamed %s -> %s'
832 > % (metadata[b'oid'], ret[0], self._revlog.filename))
833 > return ret
834 > EOF
835
836 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v --no-lfs \
837 > --config extensions.x=$TESTTMP/lfsrename.py
802 repository uses revlog format 1
838 repository uses revlog format 1
803 checking changesets
839 checking changesets
804 checking manifests
840 checking manifests
805 crosschecking files in changesets and manifests
841 crosschecking files in changesets and manifests
806 checking files
842 checking files
807 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
843 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
844 lfs blob sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e renamed large -> l
808 checked 5 changesets with 10 changes to 4 files
845 checked 5 changesets with 10 changes to 4 files
809
846
810 Verify will not try to download lfs blobs, if told not to by the config option
847 Verify will not try to download lfs blobs, if told not to by the config option
811
848
812 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v \
849 $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v \
813 > --config verify.skipflags=8192
850 > --config verify.skipflags=8192 \
851 > --config extensions.x=$TESTTMP/lfsrename.py
814 repository uses revlog format 1
852 repository uses revlog format 1
815 checking changesets
853 checking changesets
816 checking manifests
854 checking manifests
817 crosschecking files in changesets and manifests
855 crosschecking files in changesets and manifests
818 checking files
856 checking files
819 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
857 lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store
858 lfs blob sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e renamed large -> l
820 checked 5 changesets with 10 changes to 4 files
859 checked 5 changesets with 10 changes to 4 files
821
860
822 Verify will copy/link all lfs objects into the local store that aren't already
861 Verify will copy/link all lfs objects into the local store that aren't already
General Comments 0
You need to be logged in to leave comments. Login now