D7708: lfs: add a switch to `hg verify` to ignore the content of blobs

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Tue Jan 14 11:13:51 EST 2020


Closed by commit rHGe540103ce945: lfs: add a switch to `hg verify` to ignore the content of blobs (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7708?vs=18904&id=19212

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7708/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7708

AFFECTED FILES
  hgext/lfs/__init__.py
  tests/test-lfs.t

CHANGE DETAILS

diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -796,6 +796,27 @@
   $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e
   [1]
 
+Verify will not try to download lfs blobs, if told not to process lfs content
+
+  $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v --no-lfs
+  repository uses revlog format 1
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  checked 5 changesets with 10 changes to 4 files
+
+Verify will not try to download lfs blobs, if told not to by the config option
+
+  $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v \
+  >                   --config verify.skipflags=8192
+  repository uses revlog format 1
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  checked 5 changesets with 10 changes to 4 files
+
 Verify will copy/link all lfs objects into the local store that aren't already
 present.  Bypass the corrupted usercache to show that verify works when fed by
 the (uncorrupted) remote store.
diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -402,3 +402,24 @@
     revs = opts.get('rev', [])
     pointers = wrapper.extractpointers(repo, scmutil.revrange(repo, revs))
     wrapper.uploadblobs(repo, pointers)
+
+
+ at eh.wrapcommand(
+    b'verify', opts=[(b'', b'no-lfs', None, _(b'skip all lfs blob content'))]
+)
+def verify(orig, ui, repo, **opts):
+    skipflags = repo.ui.configint(b'verify', b'skipflags')
+    no_lfs = opts.pop('no_lfs')
+
+    if skipflags:
+        # --lfs overrides the config bit, if set.
+        if no_lfs is False:
+            skipflags &= ~repository.REVISION_FLAG_EXTSTORED
+    else:
+        skipflags = 0
+
+    if no_lfs is True:
+        skipflags |= repository.REVISION_FLAG_EXTSTORED
+
+    with ui.configoverride({(b'verify', b'skipflags'): skipflags}):
+        return orig(ui, repo, **opts)



To: mharbison72, #hg-reviewers, indygreg, pulkit
Cc: indygreg, pulkit, mercurial-devel


More information about the Mercurial-devel mailing list