Mercurial > hg-stable
changeset 35964:d857cad588e4
lfs: prefetch lfs blobs during revert
The revert command oddly prints out what it will do before requesting the files
to be prefetched. But the 'need to transfer' line indicates the blobs are being
grouped.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 04 Feb 2018 00:33:28 -0500 |
parents | efbd04238029 |
children | 533f04d4cb6d |
files | hgext/lfs/__init__.py hgext/lfs/wrapper.py tests/test-lfs-test-server.t |
diffstat | 3 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/lfs/__init__.py Sun Feb 04 14:14:28 2018 -0500 +++ b/hgext/lfs/__init__.py Sun Feb 04 00:33:28 2018 -0500 @@ -333,6 +333,7 @@ wrapfunction(hg, 'postshare', wrapper.hgpostshare) wrapfunction(merge, 'applyupdates', wrapper.mergemodapplyupdates) + wrapfunction(cmdutil, '_prefetchfiles', wrapper.cmdutilprefetchfiles) # Make bundle choose changegroup3 instead of changegroup2. This affects # "hg bundle" command. Note: it does not cover all bundle formats like
--- a/hgext/lfs/wrapper.py Sun Feb 04 14:14:28 2018 -0500 +++ b/hgext/lfs/wrapper.py Sun Feb 04 00:33:28 2018 -0500 @@ -266,6 +266,12 @@ if pointers: repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore) +def cmdutilprefetchfiles(orig, repo, ctx, files): + """Prefetch the indicated files before they are accessed by a command.""" + orig(repo, ctx, files) + + _prefetchfiles(repo, ctx, files) + def mergemodapplyupdates(orig, repo, actions, wctx, mctx, overwrite, labels=None): """Ensure that the required LFS blobs are present before applying updates,
--- a/tests/test-lfs-test-server.t Sun Feb 04 14:14:28 2018 -0500 +++ b/tests/test-lfs-test-server.t Sun Feb 04 00:33:28 2018 -0500 @@ -149,6 +149,33 @@ (run hg verify) [255] +Revert will prefetch blobs in a group + + $ rm -rf .hg/store/lfs + $ rm -rf `hg config lfs.usercache` + $ rm * + $ hg revert --all -r 1 -v + adding a + reverting b + reverting c + reverting d + lfs: need to transfer 4 objects (63 bytes) + lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) + lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache + lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b + lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) + lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b + lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes) + lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache + lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 + lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) + lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache + lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 + lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store + lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store + lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store + lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store + Check error message when the remote missed a blob: $ echo FFFFF > b