Mercurial > hg
comparison hgext/lfs/wrapper.py @ 44072:1a6dd50cd0db
lfs: don't skip locally available blobs when verifying
The `skipflags` config was introduced in a2ab9ebcd85b, which specifically calls
out downloading and storing all blobs as potentially too expensive. But I don't
see any reason to skip blobs that are already available locally. Hashing the
blob is the only way to indirectly verify the rawdata content stored in the
revlog.
(The note in that commit about skipping renamed is still correct, but the reason
given about needing fulltext isn't.)
Differential Revision: https://phab.mercurial-scm.org/D7712
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 22 Dec 2019 23:50:19 -0500 |
parents | 26cf356ae772 |
children | b9e174d4ed11 |
comparison
equal
deleted
inserted
replaced
44071:34e8305f02bd | 44072:1a6dd50cd0db |
---|---|
221 # fast path: use lfs metadata to answer size | 221 # fast path: use lfs metadata to answer size |
222 rawtext = self._revlog.rawdata(rev) | 222 rawtext = self._revlog.rawdata(rev) |
223 metadata = pointer.deserialize(rawtext) | 223 metadata = pointer.deserialize(rawtext) |
224 return int(metadata[b'size']) | 224 return int(metadata[b'size']) |
225 return orig(self, rev) | 225 return orig(self, rev) |
226 | |
227 | |
228 @eh.wrapfunction(revlog, b'_verify_revision') | |
229 def _verify_revision(orig, rl, skipflags, state, node): | |
230 if _islfs(rl, node=node): | |
231 rawtext = rl.rawdata(node) | |
232 metadata = pointer.deserialize(rawtext) | |
233 | |
234 # Don't skip blobs that are stored locally, as local verification is | |
235 # relatively cheap and there's no other way to verify the raw data in | |
236 # the revlog. | |
237 if rl.opener.lfslocalblobstore.has(metadata.oid()): | |
238 skipflags &= ~revlog.REVIDX_EXTSTORED | |
239 | |
240 orig(rl, skipflags, state, node) | |
226 | 241 |
227 | 242 |
228 @eh.wrapfunction(context.basefilectx, b'cmp') | 243 @eh.wrapfunction(context.basefilectx, b'cmp') |
229 def filectxcmp(orig, self, fctx): | 244 def filectxcmp(orig, self, fctx): |
230 """returns True if text is different than fctx""" | 245 """returns True if text is different than fctx""" |