| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -eu |
| 4 |
|
| 5 |
# Sparse-revlog usually shows the most gain on Manifest. However, it is simpler |
| 6 |
# to general an appropriate file, so we test with a single file instead. The |
| 7 |
# goal is to observe intermediate snapshot being created. |
| 8 |
# |
| 9 |
# We need a large enough file. Part of the content needs to be replaced |
| 10 |
# repeatedly while some of it changes rarely. |
| 11 |
|
| 12 |
bundlepath="$TESTDIR/artifacts/cache/big-file-churn.hg" |
| 13 |
expectedhash=`cat "$bundlepath".md5` |
| 14 |
|
| 15 |
LAZY_GEN="--lazy" |
| 16 |
if [ "$SLOW" == "1" ]; then |
| 17 |
LAZY_GEN="" |
| 18 |
fi |
| 19 |
|
| 20 |
if [ "$PURE" == "1" ]; then |
| 21 |
if [ ! -f "$bundlepath" ]; then |
| 22 |
echo 'skipped: missing artifact, run "'"$TESTDIR"'/artifacts/scripts/generate-churning-bundle.py"' > "$TESTTMP/SKIPPED" |
| 23 |
exit |
| 24 |
fi |
| 25 |
currenthash=`f -M "$bundlepath" | cut -d = -f 2` |
| 26 |
if [ "$currenthash" != "$expectedhash" ]; then |
| 27 |
echo 'skipped: outdated artifact, md5 "'"$currenthash"'" expected "'"$expectedhash"'" run "'"$TESTDIR"'/artifacts/scripts/generate-churning-bundle.py"' > "$TESTTMP/SKIPPED" |
| 28 |
exit |
| 29 |
fi |
| 30 |
fi |
| 31 |
|
| 32 |
# If the validation fails, either something is broken or the expected md5 need |
| 33 |
# updating. To update the md5, invoke the script without --validate |
| 34 |
|
| 35 |
"$TESTDIR"/artifacts/scripts/generate-churning-bundle.py --validate $LAZY_GEN > /dev/null |
| 36 |
|
| 37 |
cat >> $HGRCPATH << EOF |
| 38 |
[format] |
| 39 |
sparse-revlog = yes |
| 40 |
maxchainlen = 15 |
| 41 |
revlog-compression=zlib |
| 42 |
[storage] |
| 43 |
revlog.optimize-delta-parent-choice = yes |
| 44 |
revlog.reuse-external-delta-parent = no |
| 45 |
revlog.reuse-external-delta = no |
| 46 |
revlog.reuse-external-delta-compression = no |
| 47 |
delta-fold-estimate = always |
| 48 |
[format] |
| 49 |
use-delta-info-flags=$DELTA_INFO |
| 50 |
EOF |
| 51 |
|
| 52 |
hg init sparse-repo |
| 53 |
hg -R sparse-repo unbundle $bundlepath |
| 54 |
hg -R sparse-repo update |
| 55 |
hg --cwd sparse-repo debugrevlog "SPARSE-REVLOG-TEST-FILE" > ./revlog-stats-reference.txt |