sapling/eden/scm/tests/test-fb-hgext-treemanifest-autoconvert.t
Durham Goode 49ac0401b7 discovery: go back to random sampling but include master
Summary:
An earlier change (D21394302) made discovery sampling use the most
recent commits. This ended up not being correct since if the requested sample
did not find any hits then the unknown set would not be reduced and the next
requested set would not change, resulting in an infinite loop.

The goal of the original diff was to ensure master was in the initial sample set
so we didn't have to inspect a bunch of really old commits. Let's go back to
random sampling, but manually insert master into the initial set.

In the long-term we should throw away all this code and use something similar to
discovery.fastdiscovery instead which just relies on the public heads.

Reviewed By: quark-zju

Differential Revision: D21577331

fbshipit-source-id: d738de255e292fc569eb27f250dcd3eaafaaae43
2020-05-15 19:03:29 -07:00

74 lines
2.2 KiB
Perl

$ . "$TESTDIR/library.sh"
$ setconfig devel.print-metrics=1
$ hginit master
$ cd master
$ cat >> .hg/hgrc <<EOF
> [treemanifest]
> server=True
> [remotefilelog]
> server=True
> EOF
$ echo x > x
$ hg commit -qAm 'add x'
$ cd ..
$ hgcloneshallow ssh://user@dummy/master client -q
fetching tree '' bc0c2c938b929f98b1c31a8c5994396ebb096bf0
1 trees fetched over * (glob)
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) (?)
{ metrics : { ssh : { connections : 2,
getpack : { calls : 1, revs : 1},
gettreepack : { basemfnodes : 0,
calls : 1,
mfnodes : 1},
read : { bytes : 1983},
write : { bytes : 1018}}}}
$ cd client
$ cat >> .hg/hgrc <<EOF
> [treemanifest]
> autocreatetrees=True
> EOF
Test auto creating trees for merge commit
$ cd ../master
$ hg up -q null
$ echo z >> z
$ hg commit -qAm 'add z'
$ hg up -q 0
$ hg merge -q -r 1
$ hg commit -qAm 'merge'
$ cd ../client
$ hg pull
pulling from ssh://user@dummy/master
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 0 changes to 0 files
{ metrics : { ssh : { connections : 1,
read : { bytes : 1126},
write : { bytes : 709}}}}
$ hg manifest -r tip
fetching tree '' 13532a59874531175abc845749c0491b36effb18, based on bc0c2c938b929f98b1c31a8c5994396ebb096bf0, found via 92f4ca0e667c
1 trees fetched over 0.00s
x
z
{ metrics : { ssh : { connections : 1,
gettreepack : { basemfnodes : 1,
calls : 1,
mfnodes : 1},
read : { bytes : 872},
write : { bytes : 263}}}}
$ hg debughistorypack $TESTTMP/hgcache/master/packs/manifests/*.histidx
Node P1 Node P2 Node Link Node Copy From
13532a598745 bc0c2c938b92 ddb35f099a64 92f4ca0e667c
Node P1 Node P2 Node Link Node Copy From
bc0c2c938b92 000000000000 000000000000 085784c01c08