sapling/tests/test-treemanifest-backfill.t
Durham Goode 911ea4ace5 treemanifest: add backfilltree command
Summary:
This adds a command for producing tree manifests for existing manifests in the
repository. The tree manifests are stored similar to how vanilla mercurial
stores them, but the root revs are in 00manifestree.i instead of 00manifest.i
and we fake the root node to be the same as the flat manifest node, so we can
reference either the flat or the tree easily.

Test Plan: Added a test. Also began converting fbsource

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: stash, mjpieters

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

Signature: t1:4092252:1478260394:a55360a8ba83ad85b1694cb93f0788f1f672ef61
2017-03-09 14:45:23 -08:00

73 lines
2.6 KiB
Raku

$ CACHEDIR=`pwd`/hgcache
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ hg init master
$ cd master
$ echo x > x
$ hg commit -qAm 'add x'
$ mkdir subdir
$ echo z > subdir/z
$ hg commit -qAm 'add subdir/z'
$ echo x >> x
$ hg commit -qAm 'modify x'
$ cat >> .hg/hgrc <<EOF
> [extensions]
> treemanifest=
>
> [remotefilelog]
> name=master
> cachepath=$CACHEDIR
> usefastdatapack=True
>
> [fastmanifest]
> usetree=True
> usecache=False
>
> [treemanifest]
> server=True
> EOF
$ hg backfilltree -l 1 --traceback
$ ls .hg/store/00m*
.hg/store/00manifest.i
.hg/store/00manifesttree.i
$ hg debugindex .hg/store/00manifesttree.i
rev offset length delta linkrev nodeid p1 p2
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
$ hg debugindex .hg/store/00manifest.i
rev offset length delta linkrev nodeid p1 p2
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
1 44 62 0 1 70f2c6726cec bc0c2c938b92 000000000000
2 106 55 1 2 68221fc1644f 70f2c6726cec 000000000000
$ hg backfilltree -l 1 --traceback
$ ls .hg/store/00m*
.hg/store/00manifest.i
.hg/store/00manifesttree.i
$ ls .hg/store/meta
subdir
$ hg debugindex .hg/store/00manifesttree.i
rev offset length delta linkrev nodeid p1 p2
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
1 44 61 0 1 70f2c6726cec bc0c2c938b92 000000000000
$ hg debugindex .hg/store/00manifest.i
rev offset length delta linkrev nodeid p1 p2
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
1 44 62 0 1 70f2c6726cec bc0c2c938b92 000000000000
2 106 55 1 2 68221fc1644f 70f2c6726cec 000000000000
$ hg debugdata .hg/store/00manifesttree.i 0
x\x001406e74118627694268417491f018a4a883152f0 (esc)
$ hg debugdata .hg/store/00manifesttree.i 1
subdir\x00ddb35f099a648a43a997aef53123bce309c794fdt (esc)
x\x001406e74118627694268417491f018a4a883152f0 (esc)
Test backfilling all at once
$ rm -rf .hg/store/00manifesttree.i .hg/store/meta
$ hg backfilltree
$ hg debugindex .hg/store/00manifesttree.i
rev offset length delta linkrev nodeid p1 p2
0 0 44 -1 0 bc0c2c938b92 000000000000 000000000000
1 44 61 0 1 70f2c6726cec bc0c2c938b92 000000000000
2 105 55 1 2 68221fc1644f 70f2c6726cec 000000000000