Mercurial > hg
comparison hgext/lfs/__init__.py @ 44071:34e8305f02bd
lfs: add a switch to `hg verify` to ignore the content of blobs
Trying to validate the fulltext of an external revision causes missing blobs to
be downloaded and cached. Since the downloads aren't batch prefetched[1] and
aren't compressed, this can be expensive both in terms of time and space.
I made this a tri-state instead of a simple bool because there's an existing
(undocumented) config to handle this, and it would be weird if `hg verify` were
to suddenly start ignoring that config but an `hg recover` initiated verify
honors it. Since this uses the same config setting, it too will skip
rename verification (which requires fulltext, but not for LFS).
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-April/116118.html
Differential Revision: https://phab.mercurial-scm.org/D7708
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 20 Dec 2019 01:11:35 -0500 |
parents | 9f70512ae2cf |
children | 1a6dd50cd0db |
comparison
equal
deleted
inserted
replaced
44070:451d22174b5f | 44071:34e8305f02bd |
---|---|
400 def debuglfsupload(ui, repo, **opts): | 400 def debuglfsupload(ui, repo, **opts): |
401 """upload lfs blobs added by the working copy parent or given revisions""" | 401 """upload lfs blobs added by the working copy parent or given revisions""" |
402 revs = opts.get('rev', []) | 402 revs = opts.get('rev', []) |
403 pointers = wrapper.extractpointers(repo, scmutil.revrange(repo, revs)) | 403 pointers = wrapper.extractpointers(repo, scmutil.revrange(repo, revs)) |
404 wrapper.uploadblobs(repo, pointers) | 404 wrapper.uploadblobs(repo, pointers) |
405 | |
406 | |
407 @eh.wrapcommand( | |
408 b'verify', opts=[(b'', b'no-lfs', None, _(b'skip all lfs blob content'))] | |
409 ) | |
410 def verify(orig, ui, repo, **opts): | |
411 skipflags = repo.ui.configint(b'verify', b'skipflags') | |
412 no_lfs = opts.pop('no_lfs') | |
413 | |
414 if skipflags: | |
415 # --lfs overrides the config bit, if set. | |
416 if no_lfs is False: | |
417 skipflags &= ~repository.REVISION_FLAG_EXTSTORED | |
418 else: | |
419 skipflags = 0 | |
420 | |
421 if no_lfs is True: | |
422 skipflags |= repository.REVISION_FLAG_EXTSTORED | |
423 | |
424 with ui.configoverride({(b'verify', b'skipflags'): skipflags}): | |
425 return orig(ui, repo, **opts) |