hg: add test for setting treemanifest.sendtrees=True

Summary:
I will be enabling this config on its own more broadly soon. Let's add
a test just to verify it works without treeonly=True being set (which is what
most other tests already test).

Reviewed By: quark-zju

Differential Revision: D7004366

fbshipit-source-id: 5743fbfd23da7327d1779f8555c42a8845d60271
This commit is contained in:
Durham Goode 2018-02-20 10:34:23 -08:00 committed by Saurabh Singh
parent 2e0e2f49f6
commit 5282ddbf02
2 changed files with 101 additions and 1 deletions

View File

@ -66,7 +66,7 @@ hginit() {
local name
name=$1
shift
hg init $name $@
hg init $name $@ --config remotefilelog.reponame=master
}
clearcache() {

View File

@ -0,0 +1,100 @@
$ . "$TESTDIR/library.sh"
$ cat >> $HGRCPATH <<EOF
> [extensions]
> pushrebase=
> remotenames=
> [treemanifest]
> sendtrees=True
> EOF
Setup the server
$ hginit master
$ cd master
$ cat >> .hg/hgrc <<EOF
> [extensions]
> bundle2hooks=
> treemanifest=
> [treemanifest]
> server=True
> [remotefilelog]
> server=True
> shallowtrees=True
> EOF
Make local commits on the server
$ mkdir subdir
$ echo x > subdir/x
$ hg commit -qAm 'add subdir/x'
$ hg book master
The following will turn on sendtrees mode for a hybrid client and verify it
sends them during a push and during bundle operations.
Create flat manifest clients
$ cd ..
$ hgcloneshallow ssh://user@dummy/master client1 -q
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
$ hgcloneshallow ssh://user@dummy/master client2 -q
Transition to hybrid flat+tree client
$ cat >> client1/.hg/hgrc <<EOF
> [extensions]
> fbamend=
> fastmanifest=
> treemanifest=
> [fastmanifest]
> usetree=True
> usecache=False
> [treemanifest]
> demanddownload=True
> EOF
$ cat >> client2/.hg/hgrc <<EOF
> [extensions]
> fbamend=
> fastmanifest=
> treemanifest=
> [fastmanifest]
> usetree=True
> usecache=False
> [treemanifest]
> demanddownload=True
> EOF
Make a draft commit
$ cd client1
$ echo f >> subdir/x
$ hg commit -qm "hybrid commit"
2 trees fetched over * (glob)
$ hg debugdatapack .hg/store/packs/manifests/*datapack
.hg/store/packs/manifests/da9af3771b30963e2eb5624a2df366eb989223c1:
subdir:
Node Delta Base Delta Length Blob Size
97c1b2747888 000000000000 43 (missing)
(empty name):
Node Delta Base Delta Length Blob Size
c0196aba344d 000000000000 49 (missing)
Test bundling/unbundling
$ hg bundle -r . --base '.^' ../treebundle.hg --debug | grep treegroup
bundle2-output-part: "b2x:treegroup2" (params: 3 mandatory) streamed payload
$ cd ../client2
$ hg unbundle ../treebundle.hg --debug | grep treegroup
bundle2-input-part: "b2x:treegroup2" (params: 3 mandatory) supported
$ hg debugdatapack .hg/store/packs/manifests/*datapack
.hg/store/packs/manifests/da9af3771b30963e2eb5624a2df366eb989223c1:
subdir:
Node Delta Base Delta Length Blob Size
97c1b2747888 000000000000 43 (missing)
(empty name):
Node Delta Base Delta Length Blob Size
c0196aba344d 000000000000 49 (missing)
Test pushing
$ hg push -r tip --to master --debug | grep treegroup
bundle2-output-part: "b2x:treegroup2" (params: 3 mandatory) streamed payload