# HG changeset patch # User Matt Harbison # Date 1517772692 18000 # Node ID 533f04d4cb6d7914c658a80fff048a743f64fddd # Parent d857cad588e4102fa1664347af0740395119ec0c archive: call the storage prefetch hook diff -r d857cad588e4 -r 533f04d4cb6d mercurial/archival.py --- a/mercurial/archival.py Sun Feb 04 00:33:28 2018 -0500 +++ b/mercurial/archival.py Sun Feb 04 14:31:32 2018 -0500 @@ -18,6 +18,7 @@ from .i18n import _ from . import ( + cmdutil, error, formatter, match as matchmod, @@ -337,6 +338,7 @@ total = len(files) if total: files.sort() + cmdutil._prefetchfiles(repo, ctx, files) repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) for i, f in enumerate(files): ff = ctx.flags(f) diff -r d857cad588e4 -r 533f04d4cb6d mercurial/subrepo.py --- a/mercurial/subrepo.py Sun Feb 04 00:33:28 2018 -0500 +++ b/mercurial/subrepo.py Sun Feb 04 14:31:32 2018 -0500 @@ -919,9 +919,13 @@ @annotatesubrepoerror def archive(self, archiver, prefix, match=None, decode=True): self._get(self._state + ('hg',)) - total = abstractsubrepo.archive(self, archiver, prefix, match) + files = self.files() + if match: + files = [f for f in files if match(f)] rev = self._state[1] ctx = self._repo[rev] + cmdutil._prefetchfiles(self._repo, ctx, files) + total = abstractsubrepo.archive(self, archiver, prefix, match) for subpath in ctx.substate: s = subrepo(ctx, subpath, True) submatch = matchmod.subdirmatcher(subpath, match) diff -r d857cad588e4 -r 533f04d4cb6d tests/test-lfs-test-server.t --- a/tests/test-lfs-test-server.t Sun Feb 04 00:33:28 2018 -0500 +++ b/tests/test-lfs-test-server.t Sun Feb 04 14:31:32 2018 -0500 @@ -149,6 +149,34 @@ (run hg verify) [255] +Archive will prefetch blobs in a group + + $ rm -rf .hg/store/lfs `hg config lfs.usercache` + $ hg archive -vr 1 ../archive + 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 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store + lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store + lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store + $ find ../archive | sort + ../archive + ../archive/.hg_archival.txt + ../archive/a + ../archive/b + ../archive/c + ../archive/d + Revert will prefetch blobs in a group $ rm -rf .hg/store/lfs