diff --git a/tests/test-treemanifest-prefetch.t b/tests/test-treemanifest-prefetch.t --- a/tests/test-treemanifest-prefetch.t +++ b/tests/test-treemanifest-prefetch.t @@ -82,6 +82,7 @@ > fastmanifest=$TESTDIR/../fastmanifest > [remotefilelog] > reponame = master + > prefetchdays=0 > cachepath = $CACHEDIR > [fastmanifest] > usetree = True @@ -470,3 +471,25 @@ $ ls_l $CACHEDIR/master/packs/manifests | grep datapack | wc -l \s*1 (re) #endif + +Test prefetching with no options works. The expectation is to prefetch the stuff +required for working with the draft commits which happens to be only revision 5 +in this case. + + $ rm -rf $CACHEDIR/master + +#if remotefilelog.true.shallowrepo.true +The tree prefetching code path fetches no trees for revision 5. However, the +file prefetching code path fetches 1 file for revision 5 and while doing so, +also fetches 3 trees dealing with the tree manifest of the base revision 2. + + $ hg prefetch + 0 trees fetched over * (glob) + 3 trees fetched over * (glob) + 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) +#else +The tree prefetching code path fetches no trees for revision 5. And there is no +prefetching of files in this test case. + $ hg prefetch + 0 trees fetched over * (glob) +#endif diff --git a/treemanifest/__init__.py b/treemanifest/__init__.py --- a/treemanifest/__init__.py +++ b/treemanifest/__init__.py @@ -1049,8 +1049,11 @@ def _prefetchonlytrees(repo, opts): opts = resolveprefetchopts(repo.ui, opts) revs = scmutil.revrange(repo, opts.get('rev')) + draftrevs = repo.revs('draft()') mfnodes = set() - for rev in revs: + + # No trees need to be downloaded for the draft commits. + for rev in revs - draftrevs: mfnodes.add(repo[rev].manifestnode()) basemfnode = set()