sapling/tests/test-treemanifest.t
Durham Goode 3f65bd2532 treemanifest: don't build pack files that depend on other pack files
Summary:
Previously, when treemanifest would create packs of trees during pull, we
allowed trees to be delta'd against trees in other packs. This resulted in
smaller packs, but if the other pack disappeared for some reason (since it's a
cache), the chain broke.

This patch ensures that the first version of every tree added to a pack is a
full text.

This temporarily makes repacks worse, since the repacker doesn't know about
history to produce deltas when combining packs. The next patch adds history
awareness which improves the repack deltafication.

Test Plan:
Updated the tests, and inspected the new test results to ensure that
all packs only had deltas within the pack.

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4647348

Signature: t1:4647348:1488882214:e850622a853a534fc60caeef604c88c30740c60d
2017-03-07 11:15:25 -08:00

106 lines
2.7 KiB
Raku

$ . "$TESTDIR/library.sh"
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ hginit master
$ cd master
$ cat >> .hg/hgrc <<EOF
> [remotefilelog]
> server=True
> EOF
$ echo x > x
$ hg commit -qAm 'add x'
$ cd ..
$ hgcloneshallow ssh://user@dummy/master client -q
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
$ cd client
$ cat >> .hg/hgrc <<EOF
> [extensions]
> fastmanifest=
> treemanifest=
>
> [remotefilelog]
> usefastdatapack=True
>
> [fastmanifest]
> usetree=True
> usecache=False
>
> [treemanifest]
> usecunionstore=True
> EOF
Test autocreatetrees
$ cat >> .hg/hgrc <<EOF
> [treemanifest]
> autocreatetrees=True
> EOF
$ cd ../master
$ mkdir subdir
$ echo z >> subdir/z
$ hg commit -qAm 'add subdir/z'
$ cd ../client
$ hg pull
pulling from ssh://user@dummy/master
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 0 changes to 0 files
(run 'hg update' to get a working copy)
$ ls -l $CACHEDIR/master/packs/manifests
total * (glob)
* 1146 * 194862a96c9896c52b5dbc5502998d76501edb2e.dataidx (glob)
* 316 * 194862a96c9896c52b5dbc5502998d76501edb2e.datapack (glob)
* 1098 * 3513dce7ac2aba49a796f9527afc94a36fd536e8.histidx (glob)
* 184 * 3513dce7ac2aba49a796f9527afc94a36fd536e8.histpack (glob)
$ hg debugdatapack $CACHEDIR/master/packs/manifests/194862a96c9896c52b5dbc5502998d76501edb2e
Node Delta Base Delta Length
bc0c2c938b92 000000000000 43
subdir/
Node Delta Base Delta Length
ddb35f099a64 000000000000 43
Node Delta Base Delta Length
70f2c6726cec bc0c2c938b92 61
Test that commit creates local trees
$ hg up -q tip
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
$ echo z >> subdir/z
$ hg commit -qAm 'modify subdir/z'
$ ls -l .hg/store/packs/manifests
* (glob)
* 1106 * 5ae421f7ddd38490fe5bb8fb379861746c7377d4.dataidx (glob)
* 255 * 5ae421f7ddd38490fe5bb8fb379861746c7377d4.datapack (glob)
$ hg debugdatapack .hg/store/packs/manifests/5ae421f7ddd38490fe5bb8fb379861746c7377d4
subdir/
Node Delta Base Delta Length
ac728a786423 000000000000 43
Node Delta Base Delta Length
7a911436836f 000000000000 92
Test that manifest matchers work
$ hg status --rev 1 --rev 2 -I subdir/a
$ hg status --rev 1 --rev 2 -I subdir/z
M subdir/z
Test config validation
$ hg log -r . --config extensions.fastmanifest=!
abort: cannot use treemanifest without fastmanifest
[255]
$ hg log -r . --config extensions.treemanifest=!
abort: fastmanifest.usetree cannot be enabled without enabling treemanifest
[255]