2019-12-10 02:24:31 +03:00
|
|
|
#chg-compatible
|
|
|
|
|
2017-04-27 20:44:34 +03:00
|
|
|
$ CACHEDIR=`pwd`/hgcache
|
2021-02-11 20:33:15 +03:00
|
|
|
$ setconfig remotefilelog.write-hgcache-to-indexedlog=False remotefilelog.write-local-to-indexedlog=False
|
2017-04-27 20:44:34 +03:00
|
|
|
|
2018-02-02 21:04:17 +03:00
|
|
|
$ . "$TESTDIR/library.sh"
|
|
|
|
|
|
|
|
Create server
|
|
|
|
$ hginit master
|
|
|
|
$ cd master
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
2017-11-03 19:24:39 +03:00
|
|
|
> [treemanifest]
|
2018-02-02 21:04:17 +03:00
|
|
|
> server=True
|
|
|
|
> [remotefilelog]
|
|
|
|
> server=True
|
2017-11-03 19:24:39 +03:00
|
|
|
> EOF
|
|
|
|
|
2018-02-02 21:04:17 +03:00
|
|
|
$ mkdir subdir
|
|
|
|
$ echo x > subdir/x
|
|
|
|
$ hg commit -qAm 'add subdir/x'
|
|
|
|
$ cd ..
|
2017-04-27 20:44:34 +03:00
|
|
|
|
2018-02-02 21:04:17 +03:00
|
|
|
Create client2 - it will have only the first commit, so client1 will be pushing
|
|
|
|
two server and one local commits later.
|
|
|
|
$ hgcloneshallow ssh://user@dummy/master client2 -q
|
2020-09-24 19:44:20 +03:00
|
|
|
fetching tree '' 85b359fdb09e9b8d7ac4a74551612b277345e8fd, found via 2278cc8c6ce6
|
2019-10-28 18:42:32 +03:00
|
|
|
2 trees fetched over * (glob)
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
2018-02-02 21:04:17 +03:00
|
|
|
$ cat >> client2/.hg/hgrc <<EOF
|
2017-04-27 20:44:34 +03:00
|
|
|
> [remotefilelog]
|
|
|
|
> reponame=master
|
|
|
|
> cachepath=$CACHEDIR
|
|
|
|
> EOF
|
|
|
|
|
2018-02-02 21:04:17 +03:00
|
|
|
Create create two more server commits
|
|
|
|
$ cd master
|
|
|
|
$ echo x >> subdir/x
|
|
|
|
$ hg commit -m 'modify subdir/x'
|
|
|
|
$ echo x >> subdir/x
|
|
|
|
$ hg commit -m 'modify subdir/x again'
|
|
|
|
$ cd ..
|
2017-04-27 20:44:34 +03:00
|
|
|
|
2018-02-02 21:04:17 +03:00
|
|
|
Create client1 - it will have both server commits
|
|
|
|
$ hgcloneshallow ssh://user@dummy/master client1 -q
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
2020-07-02 23:11:57 +03:00
|
|
|
fetching tree '' 90044db98b33ed191d9e056e2c2ec65ae7af8338, found via b8ff91c925b4
|
|
|
|
2 trees fetched over * (glob)
|
2018-02-02 21:04:17 +03:00
|
|
|
$ cd client1
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
2017-04-27 20:44:34 +03:00
|
|
|
> [remotefilelog]
|
|
|
|
> reponame=master
|
|
|
|
> cachepath=$CACHEDIR
|
|
|
|
> EOF
|
|
|
|
|
2018-02-02 21:04:17 +03:00
|
|
|
$ echo a > a
|
|
|
|
$ mkdir dir
|
|
|
|
$ echo b > dir/b
|
|
|
|
$ hg commit -Aqm 'initial commit'
|
|
|
|
|
2017-04-27 20:44:34 +03:00
|
|
|
$ ls .hg/store/packs/manifests
|
2018-03-15 23:40:17 +03:00
|
|
|
53e6d2d846d94f543bad25dcbaa1f753c3ce9fa6.histidx
|
|
|
|
53e6d2d846d94f543bad25dcbaa1f753c3ce9fa6.histpack
|
2018-12-21 04:48:27 +03:00
|
|
|
b7cac023ec87107fd7c501085ba31c96485d802d.dataidx
|
|
|
|
b7cac023ec87107fd7c501085ba31c96485d802d.datapack
|
2017-04-27 20:44:34 +03:00
|
|
|
|
2018-02-02 21:04:17 +03:00
|
|
|
$ clearcache
|
|
|
|
|
|
|
|
Pushing p2p with sendtrees=True puts the received packs in the local pack store
|
|
|
|
# Prefetch client2 so we dont see any downloads related to what the target
|
|
|
|
# already has.
|
|
|
|
$ hg -R ../client2 prefetch -r 'all()'
|
2020-01-09 18:44:55 +03:00
|
|
|
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
2020-09-24 19:44:20 +03:00
|
|
|
fetching tree '' 85b359fdb09e9b8d7ac4a74551612b277345e8fd, found via 2278cc8c6ce6
|
2020-07-02 23:11:57 +03:00
|
|
|
2 trees fetched over * (glob)
|
2018-06-30 01:36:59 +03:00
|
|
|
$ cp ../client2/.hg/hgrc ../client2/.hg/hgrc.bak
|
|
|
|
$ cat >> ../client2/.hg/hgrc <<EOF
|
|
|
|
> [remotefilelog]
|
|
|
|
> cachepath=$CACHEDIR/cache2
|
|
|
|
> EOF
|
|
|
|
|
remotefilelog: don't process manifests when not necessary
Summary:
When building a bundle that will be used for a pull that can't use the linkrev
fastpath, we need to process the manifests of the commits for which we will
send files so that we can correctly set up their linkrevs. Currently this is
sometimes happening for all commits, which can be very slow when pulling a
large number of commits.
First, make it clearer what `LocalFiles` and `LocalTrees` means, and make it
easier to test for trees being local.
Second, when processing manifests looking for files that will be included in
the bundle, don't process non-local trees if we are only interested in local
trees.
Third, correctly determine whether to send all, local, or no trees or files
depending on what combinations of treemanifest and remotefilelog the client and
server support, and what operation is taking place.
Finally, we aren't passing `b2caps` through to `changegroup.makestream` in the
changegroup part generator for bundle2 parts. This means the above test for
whether the client supports treemanifest always failed.
With these combined changes, a pull of a specific public revision (so not
following the fastpath) where the client supports both remotefilelog and
treemanifest, will result in the server using `LocalFiles` and `LocalTrees`,
and therefore not processing the manifests of public commits looking for which
files to send.
Reviewed By: DurhamG, ikostia
Differential Revision: D8446137
fbshipit-source-id: 9a4247af75fe79c1962a29fcb8bf0181868699f4
2018-06-19 20:06:24 +03:00
|
|
|
# Push and expect downloads of both public trees (in arbitrary order)
|
2020-06-10 19:26:55 +03:00
|
|
|
$ hg push -q ssh://user@dummy/client2
|
2020-01-09 18:44:55 +03:00
|
|
|
remote: 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
|
|
|
|
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over * (glob) (?)
|
2020-07-02 23:11:57 +03:00
|
|
|
fetching tree '' d9920715ba88cbc7962c4dac9f20004aafd94ac8, found via 2937cde31c19
|
|
|
|
2 trees fetched over 0.00s
|
|
|
|
fetching tree '' 90044db98b33ed191d9e056e2c2ec65ae7af8338, found via b8ff91c925b4
|
|
|
|
2 trees fetched over 0.00s
|
2017-04-27 20:44:34 +03:00
|
|
|
$ ls ../client2/.hg/store/packs/manifests
|
2020-07-02 23:11:57 +03:00
|
|
|
51e464ee849d281ededc123094852f7217b677b3.dataidx
|
|
|
|
51e464ee849d281ededc123094852f7217b677b3.datapack
|
|
|
|
8eb3321b2b6f800e1a8cc163471046748725a9bf.histidx
|
|
|
|
8eb3321b2b6f800e1a8cc163471046748725a9bf.histpack
|
2018-06-30 01:36:59 +03:00
|
|
|
$ mv ../client2/.hg/hgrc.bak ../client2/.hg/hgrc
|
2018-03-06 21:38:24 +03:00
|
|
|
$ hg debughistorypack ../client2/.hg/store/packs/manifests/*histidx
|
|
|
|
|
|
|
|
|
|
|
|
Node P1 Node P2 Node Link Node Copy From
|
2018-03-15 23:40:17 +03:00
|
|
|
3ffa0e0bbc70 90044db98b33 000000000000 54609f68e211
|
2020-07-02 23:11:57 +03:00
|
|
|
90044db98b33 d9920715ba88 000000000000 b8ff91c925b4
|
|
|
|
d9920715ba88 85b359fdb09e 000000000000 2937cde31c19
|
2018-03-06 21:38:24 +03:00
|
|
|
|
|
|
|
dir
|
|
|
|
Node P1 Node P2 Node Link Node Copy From
|
2018-03-15 23:40:17 +03:00
|
|
|
23226e7a252c 000000000000 000000000000 54609f68e211
|
2018-03-06 21:38:24 +03:00
|
|
|
|
|
|
|
subdir
|
|
|
|
Node P1 Node P2 Node Link Node Copy From
|
|
|
|
143a95c22d77 a18d21674e76 000000000000 b8ff91c925b4
|
2020-07-02 23:11:57 +03:00
|
|
|
a18d21674e76 bc0c2c938b92 000000000000 2937cde31c19
|
2018-05-18 20:13:29 +03:00
|
|
|
|
|
|
|
Pulling between peers should send local trees but not remote trees
|
|
|
|
# Strip back one server commit and one draft commit, so we can pull them again
|
|
|
|
$ cd ../client2
|
2020-10-08 21:06:31 +03:00
|
|
|
$ hg debugstrip -r 'max(desc(modify))' --no-backup
|
2018-05-18 20:13:29 +03:00
|
|
|
# Delete the old local tree data from the draft commit, so we can verify it is
|
|
|
|
# downloaded again during pull.
|
|
|
|
$ rm -rf .hg/store/packs/*
|
|
|
|
# Change this client to use a different cache from the other client, since the
|
|
|
|
# other client may populate data that we need to test if this client is
|
|
|
|
# downloading.
|
|
|
|
$ cp .hg/hgrc .hg/hgrc.bak
|
|
|
|
$ mkdir $TESTTMP/hgcache2
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [remotefilelog]
|
|
|
|
> cachepath=$TESTTMP/hgcache2
|
|
|
|
> EOF
|
|
|
|
# Force the draft commit to be public so we can ensure it's trees are delivered
|
|
|
|
# despite it being public.
|
|
|
|
$ rm -rf $TESTTMP/hgcache2/*
|
|
|
|
$ hg pull -q --config treemanifest.sendtrees=True ../client1 --config remotefilelog.fallbackpath=ssh://user@dummy/master
|
2020-05-29 23:18:07 +03:00
|
|
|
# Check that the local commits for the draft commit were downloaded to the local store.
|
2018-05-18 20:13:29 +03:00
|
|
|
$ ls_l .hg/store/packs/manifests
|
2020-07-02 23:11:57 +03:00
|
|
|
-r--r--r-- 1194 584f14ba73a87b958e438135ea033ac7fdbb2cf0.dataidx
|
|
|
|
-r--r--r-- 523 584f14ba73a87b958e438135ea033ac7fdbb2cf0.datapack
|
|
|
|
-r--r--r-- 1301 cc1beef66dec330fd4cf9dcf56707c8f57031a78.histidx
|
|
|
|
-r--r--r-- 356 cc1beef66dec330fd4cf9dcf56707c8f57031a78.histpack
|
2018-05-18 20:13:29 +03:00
|
|
|
$ hg debugdatapack .hg/store/packs/manifests/*.datapack
|
2020-07-02 23:11:57 +03:00
|
|
|
.hg/store/packs/manifests/584f14ba73a87b958e438135ea033ac7fdbb2cf0:
|
2018-05-18 20:13:29 +03:00
|
|
|
subdir:
|
|
|
|
Node Delta Base Delta Length Blob Size
|
|
|
|
143a95c22d77 000000000000 43 (missing)
|
|
|
|
|
2020-07-02 23:11:57 +03:00
|
|
|
(empty name):
|
|
|
|
Node Delta Base Delta Length Blob Size
|
|
|
|
90044db98b33 000000000000 49 (missing)
|
|
|
|
|
|
|
|
dir:
|
|
|
|
Node Delta Base Delta Length Blob Size
|
|
|
|
23226e7a252c 000000000000 43 (missing)
|
|
|
|
|
2018-05-18 20:13:29 +03:00
|
|
|
(empty name):
|
|
|
|
Node Delta Base Delta Length Blob Size
|
|
|
|
3ffa0e0bbc70 000000000000 138 (missing)
|
|
|
|
|
|
|
|
# Verify the real-public commit wasn't received during the pull and therefore
|
|
|
|
# has to be downloaded on demand.
|
|
|
|
$ rm -rf $TESTTMP/hgcache2/*
|
|
|
|
$ ls_l $TESTTMP/hgcache2/
|
|
|
|
$ hg manifest -r 'tip^'
|
|
|
|
subdir/x
|
|
|
|
# Verify the fake-public commit was received during the pull and does not
|
|
|
|
# require additional ondemand downloads.
|
|
|
|
$ hg manifest -r tip
|
|
|
|
a
|
|
|
|
dir/b
|
|
|
|
subdir/x
|
|
|
|
$ mv .hg/hgrc.bak .hg/hgrc
|