Show More
@@ -236,6 +236,10 b' def _verify_revision(orig, rl, skipflags' | |||
|
236 | 236 | # the revlog. |
|
237 | 237 | if rl.opener.lfslocalblobstore.has(metadata.oid()): |
|
238 | 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 | 244 | orig(rl, skipflags, state, node) |
|
241 | 245 |
@@ -878,7 +878,9 b' class ifilestorage(ifileindex, ifiledata' | |||
|
878 | 878 | |
|
879 | 879 | If individual revisions cannot have their revision content resolved, |
|
880 | 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 | 885 | The method yields objects conforming to the ``iverifyproblem`` |
|
884 | 886 | interface. |
@@ -2874,6 +2874,7 b' class revlog(object):' | |||
|
2874 | 2874 | ) |
|
2875 | 2875 | |
|
2876 | 2876 | state[b'skipread'] = set() |
|
2877 | state[b'safe_renamed'] = set() | |
|
2877 | 2878 | |
|
2878 | 2879 | for rev in self: |
|
2879 | 2880 | node = self.node(rev) |
@@ -529,6 +529,8 b' class verifier(object):' | |||
|
529 | 529 | else: |
|
530 | 530 | # Guard against implementations not setting this. |
|
531 | 531 | state[b'skipread'] = set() |
|
532 | state[b'safe_renamed'] = set() | |
|
533 | ||
|
532 | 534 | for problem in fl.verifyintegrity(state): |
|
533 | 535 | if problem.node is not None: |
|
534 | 536 | linkrev = fl.linkrev(fl.rev(problem.node)) |
@@ -560,7 +562,7 b' class verifier(object):' | |||
|
560 | 562 | else: |
|
561 | 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 | 566 | continue |
|
565 | 567 | |
|
566 | 568 | # check renames |
@@ -218,6 +218,15 b' enabled adds the lfs requirement' | |||
|
218 | 218 | R large |
|
219 | 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 | 230 | $ hg files -r . 'set:copied()' |
|
222 | 231 | l |
|
223 | 232 | s |
@@ -796,27 +805,57 b" because they aren't accessed." | |||
|
796 | 805 | $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e |
|
797 | 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 | 838 | repository uses revlog format 1 |
|
803 | 839 | checking changesets |
|
804 | 840 | checking manifests |
|
805 | 841 | crosschecking files in changesets and manifests |
|
806 | 842 | checking files |
|
807 | 843 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store |
|
844 | lfs blob sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e renamed large -> l | |
|
808 | 845 | checked 5 changesets with 10 changes to 4 files |
|
809 | 846 | |
|
810 | 847 | Verify will not try to download lfs blobs, if told not to by the config option |
|
811 | 848 | |
|
812 | 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 | 852 | repository uses revlog format 1 |
|
815 | 853 | checking changesets |
|
816 | 854 | checking manifests |
|
817 | 855 | crosschecking files in changesets and manifests |
|
818 | 856 | checking files |
|
819 | 857 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store |
|
858 | lfs blob sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e renamed large -> l | |
|
820 | 859 | checked 5 changesets with 10 changes to 4 files |
|
821 | 860 | |
|
822 | 861 |
|
General Comments 0
You need to be logged in to leave comments.
Login now