Mercurial > hg
view tests/test-treemanifest.t @ 46149:294d5aca4ff5
copies: iterate over children directly (instead of parents)
Before this change we would gather all parent → child edges and iterate on
all parent, gathering copy information for children and aggregating them from
there.
They are not strict requirement for edges to be processed in that specific
order. We could also simply iterate over all "children" revision and aggregate
data from both parents at the same time. This patch does that.
It make various things simpler:
* since both parents are processed at the same time, we no longer need to
cache data for merge (see next changeset for details),
* we no longer need nested loop to process data,
* we no longer need to store partial merge data for a rev from distinct loop
interaction to another when processing merges,
* we no longer need to build a full parent -> children mapping (we only rely on
a simpler "parent -> number of children" map (for memory efficiency),
* the data access pattern is now simpler (from lower revisions to higher
revisions) and entirely predicable. That predictability open the way to
prefetching and parallel processing.
So that new iterations order requires simpler code and open the way to
interesting optimisation.
The effect on performance is quite good. In the worse case, we don't see any
significant negative impact. And in the best case, the reduction of roundtrip
to Python provide us with a significant speed. Some example below:
Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev
---------------------------------------------------------------------------------------------------------------------------------------------------------------
mozilla-try x00000_revs_x00000_added_0_copies dc8a3ca7010e d16fde900c9c : 34414 revs, 0.962867 s, 0.502584 s, -0.460283 s, × 0.5220, 14 µs/rev
mozilla-try x0000_revs_xx000_added_x_copies 156f6e2674f2 4d0f2c178e66 : 8598 revs, 0.110717 s, 0.076323 s, -0.034394 s, × 0.6894, 8 µs/rev
# full comparison between the previous changeset and this one
Repo Case Source-Rev Dest-Rev # of revisions old time new time Difference Factor time per rev
---------------------------------------------------------------------------------------------------------------------------------------------------------------
mercurial x_revs_x_added_0_copies ad6b123de1c7 39cfcef4f463 : 1 revs, 0.000048 s, 0.000041 s, -0.000007 s, × 0.8542, 41 µs/rev
mercurial x_revs_x_added_x_copies 2b1c78674230 0c1d10351869 : 6 revs, 0.000153 s, 0.000102 s, -0.000051 s, × 0.6667, 17 µs/rev
mercurial x000_revs_x000_added_x_copies 81f8ff2a9bf2 dd3267698d84 : 1032 revs, 0.004209 s, 0.004254 s, +0.000045 s, × 1.0107, 4 µs/rev
pypy x_revs_x_added_0_copies aed021ee8ae8 099ed31b181b : 9 revs, 0.000203 s, 0.000282 s, +0.000079 s, × 1.3892, 31 µs/rev
pypy x_revs_x000_added_0_copies 4aa4e1f8e19a 359343b9ac0e : 1 revs, 0.000059 s, 0.000048 s, -0.000011 s, × 0.8136, 48 µs/rev
pypy x_revs_x_added_x_copies ac52eb7bbbb0 72e022663155 : 7 revs, 0.000194 s, 0.000211 s, +0.000017 s, × 1.0876, 30 µs/rev
pypy x_revs_x00_added_x_copies c3b14617fbd7 ace7255d9a26 : 1 revs, 0.000380 s, 0.000375 s, -0.000005 s, × 0.9868, 375 µs/rev
pypy x_revs_x000_added_x000_copies df6f7a526b60 a83dc6a2d56f : 6 revs, 0.010588 s, 0.010574 s, -0.000014 s, × 0.9987, 1762 µs/rev
pypy x000_revs_xx00_added_0_copies 89a76aede314 2f22446ff07e : 4785 revs, 0.048961 s, 0.049974 s, +0.001013 s, × 1.0207, 10 µs/rev
pypy x000_revs_x000_added_x_copies 8a3b5bfd266e 2c68e87c3efe : 6780 revs, 0.083612 s, 0.084300 s, +0.000688 s, × 1.0082, 12 µs/rev
pypy x000_revs_x000_added_x000_copies 89a76aede314 7b3dda341c84 : 5441 revs, 0.058579 s, 0.060128 s, +0.001549 s, × 1.0264, 11 µs/rev
pypy x0000_revs_x_added_0_copies d1defd0dc478 c9cb1334cc78 : 43645 revs, 0.736783 s, 0.686542 s, -0.050241 s, × 0.9318, 15 µs/rev
pypy x0000_revs_xx000_added_0_copies bf2c629d0071 4ffed77c095c : 2 revs, 0.022050 s, 0.009277 s, -0.012773 s, × 0.4207, 4638 µs/rev
pypy x0000_revs_xx000_added_x000_copies 08ea3258278e d9fa043f30c0 : 11316 revs, 0.120800 s, 0.114733 s, -0.006067 s, × 0.9498, 10 µs/rev
netbeans x_revs_x_added_0_copies fb0955ffcbcd a01e9239f9e7 : 2 revs, 0.000140 s, 0.000081 s, -0.000059 s, × 0.5786, 40 µs/rev
netbeans x_revs_x000_added_0_copies 6f360122949f 20eb231cc7d0 : 2 revs, 0.000114 s, 0.000107 s, -0.000007 s, × 0.9386, 53 µs/rev
netbeans x_revs_x_added_x_copies 1ada3faf6fb6 5a39d12eecf4 : 3 revs, 0.000224 s, 0.000173 s, -0.000051 s, × 0.7723, 57 µs/rev
netbeans x_revs_x00_added_x_copies 35be93ba1e2c 9eec5e90c05f : 9 revs, 0.000723 s, 0.000698 s, -0.000025 s, × 0.9654, 77 µs/rev
netbeans x000_revs_xx00_added_0_copies eac3045b4fdd 51d4ae7f1290 : 1421 revs, 0.009665 s, 0.009248 s, -0.000417 s, × 0.9569, 6 µs/rev
netbeans x000_revs_x000_added_x_copies e2063d266acd 6081d72689dc : 1533 revs, 0.014820 s, 0.015446 s, +0.000626 s, × 1.0422, 10 µs/rev
netbeans x000_revs_x000_added_x000_copies ff453e9fee32 411350406ec2 : 5750 revs, 0.076049 s, 0.074373 s, -0.001676 s, × 0.9780, 12 µs/rev
netbeans x0000_revs_xx000_added_x000_copies 588c2d1ced70 1aad62e59ddd : 66949 revs, 0.683603 s, 0.639870 s, -0.043733 s, × 0.9360, 9 µs/rev
mozilla-central x_revs_x_added_0_copies 3697f962bb7b 7015fcdd43a2 : 2 revs, 0.000161 s, 0.000088 s, -0.000073 s, × 0.5466, 44 µs/rev
mozilla-central x_revs_x000_added_0_copies dd390860c6c9 40d0c5bed75d : 8 revs, 0.000234 s, 0.000199 s, -0.000035 s, × 0.8504, 24 µs/rev
mozilla-central x_revs_x_added_x_copies 8d198483ae3b 14207ffc2b2f : 9 revs, 0.000247 s, 0.000171 s, -0.000076 s, × 0.6923, 19 µs/rev
mozilla-central x_revs_x00_added_x_copies 98cbc58cc6bc 446a150332c3 : 7 revs, 0.000630 s, 0.000592 s, -0.000038 s, × 0.9397, 84 µs/rev
mozilla-central x_revs_x000_added_x000_copies 3c684b4b8f68 0a5e72d1b479 : 3 revs, 0.003286 s, 0.003151 s, -0.000135 s, × 0.9589, 1050 µs/rev
mozilla-central x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.062441 s, 0.061612 s, -0.000829 s, × 0.9867, 10268 µs/rev
mozilla-central x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.005423 s, 0.005381 s, -0.000042 s, × 0.9923, 3 µs/rev
mozilla-central x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.005919 s, 0.003742 s, -0.002177 s, × 0.6322, 91 µs/rev
mozilla-central x000_revs_x000_added_x000_copies 7c97034feb78 4407bd0c6330 : 7839 revs, 0.062597 s, 0.061983 s, -0.000614 s, × 0.9902, 7 µs/rev
mozilla-central x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.043551 s, 0.019861 s, -0.023690 s, × 0.4560, 32 µs/rev
mozilla-central x0000_revs_xx000_added_x000_copies f78c615a656c 96a38b690156 : 30263 revs, 0.192475 s, 0.188101 s, -0.004374 s, × 0.9773, 6 µs/rev
mozilla-central x00000_revs_x0000_added_x0000_copies 6832ae71433c 4c222a1d9a00 : 153721 revs, 1.955575 s, 1.806696 s, -0.148879 s, × 0.9239, 11 µs/rev
mozilla-central x00000_revs_x00000_added_x000_copies 76caed42cf7c 1daa622bbe42 : 204976 revs, 2.886501 s, 2.682987 s, -0.203514 s, × 0.9295, 13 µs/rev
mozilla-try x_revs_x_added_0_copies aaf6dde0deb8 9790f499805a : 2 revs, 0.001181 s, 0.000852 s, -0.000329 s, × 0.7214, 426 µs/rev
mozilla-try x_revs_x000_added_0_copies d8d0222927b4 5bb8ce8c7450 : 2 revs, 0.001189 s, 0.000859 s, -0.000330 s, × 0.7225, 429 µs/rev
mozilla-try x_revs_x_added_x_copies 092fcca11bdb 936255a0384a : 4 revs, 0.000563 s, 0.000150 s, -0.000413 s, × 0.2664, 37 µs/rev
mozilla-try x_revs_x00_added_x_copies b53d2fadbdb5 017afae788ec : 2 revs, 0.001548 s, 0.001158 s, -0.000390 s, × 0.7481, 579 µs/rev
mozilla-try x_revs_x000_added_x000_copies 20408ad61ce5 6f0ee96e21ad : 1 revs, 0.027782 s, 0.027240 s, -0.000542 s, × 0.9805, 27240 µs/rev
mozilla-try x_revs_x0000_added_x0000_copies effb563bb7e5 c07a39dc4e80 : 6 revs, 0.062781 s, 0.062824 s, +0.000043 s, × 1.0007, 10470 µs/rev
mozilla-try x000_revs_xx00_added_0_copies 6100d773079a 04a55431795e : 1593 revs, 0.005778 s, 0.005463 s, -0.000315 s, × 0.9455, 3 µs/rev
mozilla-try x000_revs_x000_added_x_copies 9f17a6fc04f9 2d37b966abed : 41 revs, 0.006192 s, 0.004238 s, -0.001954 s, × 0.6844, 103 µs/rev
mozilla-try x000_revs_x000_added_x000_copies 1346fd0130e4 4c65cbdabc1f : 6657 revs, 0.065391 s, 0.064113 s, -0.001278 s, × 0.9805, 9 µs/rev
mozilla-try x0000_revs_x_added_0_copies 63519bfd42ee a36a2a865d92 : 40314 revs, 0.317216 s, 0.294063 s, -0.023153 s, × 0.9270, 7 µs/rev
mozilla-try x0000_revs_x_added_x_copies 9fe69ff0762d bcabf2a78927 : 38690 revs, 0.303119 s, 0.281493 s, -0.021626 s, × 0.9287, 7 µs/rev
mozilla-try x0000_revs_xx000_added_x_copies 156f6e2674f2 4d0f2c178e66 : 8598 revs, 0.110717 s, 0.076323 s, -0.034394 s, × 0.6894, 8 µs/rev
mozilla-try x0000_revs_xx000_added_0_copies 9eec5917337d 67118cc6dcad : 615 revs, 0.045739 s, 0.020390 s, -0.025349 s, × 0.4458, 33 µs/rev
mozilla-try x0000_revs_xx000_added_x000_copies 89294cd501d9 7ccb2fc7ccb5 : 97052 revs, 3.098021 s, 3.023879 s, -0.074142 s, × 0.9761, 31 µs/rev
mozilla-try x0000_revs_x0000_added_x0000_copies e928c65095ed e951f4ad123a : 52031 revs, 0.771480 s, 0.735549 s, -0.035931 s, × 0.9534, 14 µs/rev
mozilla-try x00000_revs_x_added_0_copies 6a320851d377 1ebb79acd503 : 363753 revs, 18.813422 s, 18.568900 s, -0.244522 s, × 0.9870, 51 µs/rev
mozilla-try x00000_revs_x00000_added_0_copies dc8a3ca7010e d16fde900c9c : 34414 revs, 0.962867 s, 0.502584 s, -0.460283 s, × 0.5220, 14 µs/rev
mozilla-try x00000_revs_x_added_x_copies 5173c4b6f97c 95d83ee7242d : 362229 revs, 18.684923 s, 18.356645 s, -0.328278 s, × 0.9824, 50 µs/rev
mozilla-try x00000_revs_x000_added_x_copies 9126823d0e9c ca82787bb23c : 359344 revs, 18.296305 s, 18.250393 s, -0.045912 s, × 0.9975, 50 µs/rev
mozilla-try x00000_revs_x0000_added_x0000_copies 8d3fafa80d4b eb884023b810 : 192665 revs, 3.061887 s, 2.792459 s, -0.269428 s, × 0.9120, 14 µs/rev
mozilla-try x00000_revs_x00000_added_x0000_copies 1b661134e2ca 1ae03d022d6d : 228985 revs, 103.869641 s, 107.697264 s, +3.827623 s, × 1.0369, 470 µs/rev
mozilla-try x00000_revs_x00000_added_x000_copies 9b2a99adc05e 8e29777b48e6 : 382065 revs, 64.262957 s, 63.961040 s, -0.301917 s, × 0.9953, 167 µs/rev
Differential Revision: https://phab.mercurial-scm.org/D9422
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 14 Dec 2020 11:32:24 +0100 |
parents | 3de4f17f4824 |
children | 95a615dd77bf |
line wrap: on
line source
$ cat << EOF >> $HGRCPATH > [ui] > ssh="$PYTHON" "$TESTDIR/dummyssh" > EOF Set up repo $ hg --config experimental.treemanifest=True init repo $ cd repo Requirements get set on init $ grep treemanifest .hg/requires treemanifest Without directories, looks like any other repo $ echo 0 > a $ echo 0 > b $ hg ci -Aqm initial $ hg debugdata -m 0 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc) b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc) Submanifest is stored in separate revlog $ mkdir dir1 $ echo 1 > dir1/a $ echo 1 > dir1/b $ echo 1 > e $ hg ci -Aqm 'add dir1' $ hg debugdata -m 1 a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc) b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc) dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44et (esc) e\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc) $ hg debugdata --dir dir1 0 a\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc) b\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc) Can add nested directories $ mkdir dir1/dir1 $ echo 2 > dir1/dir1/a $ echo 2 > dir1/dir1/b $ mkdir dir1/dir2 $ echo 2 > dir1/dir2/a $ echo 2 > dir1/dir2/b $ hg ci -Aqm 'add dir1/dir1' $ hg files -r . a b dir1/a dir1/b dir1/dir1/a dir1/dir1/b dir1/dir2/a dir1/dir2/b e The manifest command works $ hg manifest a b dir1/a dir1/b dir1/dir1/a dir1/dir1/b dir1/dir2/a dir1/dir2/b e Revision is not created for unchanged directory $ mkdir dir2 $ echo 3 > dir2/a $ hg add dir2 adding dir2/a $ hg debugindex --dir dir1 > before $ hg ci -qm 'add dir2' $ hg debugindex --dir dir1 > after $ diff before after $ rm before after Removing directory does not create an revlog entry $ hg rm dir1/dir1 removing dir1/dir1/a removing dir1/dir1/b $ hg debugindex --dir dir1/dir1 > before $ hg ci -qm 'remove dir1/dir1' $ hg debugindex --dir dir1/dir1 > after $ diff before after $ rm before after Check that hg files (calls treemanifest.walk()) works without loading all directory revlogs $ hg co 'desc("add dir2")' 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ mv .hg/store/meta/dir2 .hg/store/meta/dir2-backup $ hg files -r . dir1 dir1/a dir1/b dir1/dir1/a dir1/dir1/b dir1/dir2/a dir1/dir2/b Check that status between revisions works (calls treemanifest.matches()) without loading all directory revlogs $ hg status --rev 'desc("add dir1")' --rev . dir1 A dir1/dir1/a A dir1/dir1/b A dir1/dir2/a A dir1/dir2/b $ mv .hg/store/meta/dir2-backup .hg/store/meta/dir2 Merge creates 2-parent revision of directory revlog $ echo 5 > dir1/a $ hg ci -Aqm 'modify dir1/a' $ hg co '.^' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo 6 > dir1/b $ hg ci -Aqm 'modify dir1/b' $ hg merge 'desc("modify dir1/a")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m 'conflict-free merge involving dir1/' $ cat dir1/a 5 $ cat dir1/b 6 $ hg debugindex --dir dir1 rev linkrev nodeid p1 p2 0 1 8b3ffd73f901 000000000000 000000000000 1 2 68e9d057c5a8 8b3ffd73f901 000000000000 2 4 4698198d2624 68e9d057c5a8 000000000000 3 5 44844058ccce 68e9d057c5a8 000000000000 4 6 bf3d9b744927 68e9d057c5a8 000000000000 5 7 dde7c0af2a03 bf3d9b744927 44844058ccce Merge keeping directory from parent 1 does not create revlog entry. (Note that dir1's manifest does change, but only because dir1/a's filelog changes.) $ hg co 'desc("add dir2")' 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo 8 > dir2/a $ hg ci -m 'modify dir2/a' created new head $ hg debugindex --dir dir2 > before $ hg merge 'desc("modify dir1/a")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg revert -r 'desc("modify dir2/a")' . reverting dir1/a $ hg ci -m 'merge, keeping parent 1' $ hg debugindex --dir dir2 > after $ diff before after $ rm before after Merge keeping directory from parent 2 does not create revlog entry. (Note that dir2's manifest does change, but only because dir2/a's filelog changes.) $ hg co 'desc("modify dir2/a")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg debugindex --dir dir1 > before $ hg merge 'desc("modify dir1/a")' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg revert -r 'desc("modify dir1/a")' . reverting dir2/a $ hg ci -m 'merge, keeping parent 2' created new head $ hg debugindex --dir dir1 > after $ diff before after $ rm before after Create flat source repo for tests with mixed flat/tree manifests $ cd .. $ hg init repo-flat $ cd repo-flat Create a few commits with flat manifest $ echo 0 > a $ echo 0 > b $ echo 0 > e $ for d in dir1 dir1/dir1 dir1/dir2 dir2 > do > mkdir $d > echo 0 > $d/a > echo 0 > $d/b > done $ hg ci -Aqm initial $ echo 1 > a $ echo 1 > dir1/a $ echo 1 > dir1/dir1/a $ hg ci -Aqm 'modify on branch 1' $ hg co 0 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo 2 > b $ echo 2 > dir1/b $ echo 2 > dir1/dir1/b $ hg ci -Aqm 'modify on branch 2' $ hg merge 1 3 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m 'merge of flat manifests to new flat manifest' $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log $ cat hg.pid >> $DAEMON_PIDS Create clone with tree manifests enabled $ cd .. $ hg clone --config experimental.treemanifest=1 \ > http://localhost:$HGPORT repo-mixed -r 1 adding changesets adding manifests adding file changes added 2 changesets with 14 changes to 11 files new changesets 5b02a3e8db7e:581ef6037d8b updating to branch default 11 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd repo-mixed $ test -d .hg/store/meta [1] $ grep treemanifest .hg/requires treemanifest Should be possible to push updates from flat to tree manifest repo $ hg -R ../repo-flat push ssh://user@dummy/repo-mixed pushing to ssh://user@dummy/repo-mixed searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 2 changesets with 3 changes to 3 files Commit should store revlog per directory $ hg co 1 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo 3 > a $ echo 3 > dir1/a $ echo 3 > dir1/dir1/a $ hg ci -m 'first tree' created new head $ find .hg/store/meta | sort .hg/store/meta .hg/store/meta/dir1 .hg/store/meta/dir1/00manifest.i .hg/store/meta/dir1/dir1 .hg/store/meta/dir1/dir1/00manifest.i .hg/store/meta/dir1/dir2 .hg/store/meta/dir1/dir2/00manifest.i .hg/store/meta/dir2 .hg/store/meta/dir2/00manifest.i Merge of two trees $ hg co 2 6 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 1 3 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m 'merge of flat manifests to new tree manifest' created new head $ hg diff -r 3 Parent of tree root manifest should be flat manifest, and two for merge $ hg debugindex -m rev linkrev nodeid p1 p2 0 0 40536115ed9e 000000000000 000000000000 1 1 f3376063c255 40536115ed9e 000000000000 2 2 5d9b9da231a2 40536115ed9e 000000000000 3 3 d17d663cbd8a 5d9b9da231a2 f3376063c255 4 4 51e32a8c60ee f3376063c255 000000000000 5 5 cc5baa78b230 5d9b9da231a2 f3376063c255 Status across flat/tree boundary should work $ hg status --rev '.^' --rev . M a M dir1/a M dir1/dir1/a Turning off treemanifest config has no effect $ hg debugindex --dir dir1 rev linkrev nodeid p1 p2 0 4 064927a0648a 000000000000 000000000000 1 5 25ecb8cb8618 000000000000 000000000000 $ echo 2 > dir1/a $ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a' $ hg debugindex --dir dir1 rev linkrev nodeid p1 p2 0 4 064927a0648a 000000000000 000000000000 1 5 25ecb8cb8618 000000000000 000000000000 2 6 5b16163a30c6 25ecb8cb8618 000000000000 Stripping and recovering changes should work $ hg st --change tip M dir1/a $ hg --config extensions.strip= strip tip 1 files updated, 0 files merged, 0 files removed, 0 files unresolved saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg $ hg debugindex --dir dir1 rev linkrev nodeid p1 p2 0 4 064927a0648a 000000000000 000000000000 1 5 25ecb8cb8618 000000000000 000000000000 #if repobundlerepo $ hg incoming .hg/strip-backup/* comparing with .hg/strip-backup/*-backup.hg (glob) searching for changes changeset: 6:51cfd7b1e13b tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: modify dir1/a #endif $ hg unbundle .hg/strip-backup/* adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files new changesets 51cfd7b1e13b (1 drafts) (run 'hg update' to get a working copy) $ hg --config extensions.strip= strip tip saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/*-backup.hg (glob) $ hg unbundle -q .hg/strip-backup/* $ hg debugindex --dir dir1 rev linkrev nodeid p1 p2 0 4 064927a0648a 000000000000 000000000000 1 5 25ecb8cb8618 000000000000 000000000000 2 6 5b16163a30c6 25ecb8cb8618 000000000000 $ hg st --change tip M dir1/a Shelving and unshelving should work $ echo foo >> dir1/a $ hg shelve shelved as default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg unshelve unshelving change 'default' $ hg diff --nodates diff -r 708a273da119 dir1/a --- a/dir1/a +++ b/dir1/a @@ -1,1 +1,2 @@ 1 +foo Pushing from treemanifest repo to an empty repo makes that a treemanifest repo $ cd .. $ hg init empty-repo $ cat << EOF >> empty-repo/.hg/hgrc > [experimental] > changegroup3=yes > EOF $ grep treemanifest empty-repo/.hg/requires [1] $ hg push -R repo -r 0 empty-repo pushing to empty-repo searching for changes adding changesets adding manifests adding file changes added 1 changesets with 2 changes to 2 files $ grep treemanifest empty-repo/.hg/requires treemanifest Pushing to an empty repo works $ hg --config experimental.treemanifest=1 init clone $ grep treemanifest clone/.hg/requires treemanifest $ hg push -R repo clone pushing to clone searching for changes adding changesets adding manifests adding file changes added 11 changesets with 15 changes to 10 files (+3 heads) $ grep treemanifest clone/.hg/requires treemanifest $ hg -R clone verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 11 changesets with 15 changes to 10 files Create deeper repo with tree manifests. $ hg --config experimental.treemanifest=True init deeprepo $ cd deeprepo $ mkdir .A $ mkdir b $ mkdir b/bar $ mkdir b/bar/orange $ mkdir b/bar/orange/fly $ mkdir b/foo $ mkdir b/foo/apple $ mkdir b/foo/apple/bees $ touch .A/one.txt $ touch .A/two.txt $ touch b/bar/fruits.txt $ touch b/bar/orange/fly/gnat.py $ touch b/bar/orange/fly/housefly.txt $ touch b/foo/apple/bees/flower.py $ touch c.txt $ touch d.py $ hg ci -Aqm 'initial' $ echo >> .A/one.txt $ echo >> .A/two.txt $ echo >> b/bar/fruits.txt $ echo >> b/bar/orange/fly/gnat.py $ echo >> b/bar/orange/fly/housefly.txt $ echo >> b/foo/apple/bees/flower.py $ echo >> c.txt $ echo >> d.py $ hg ci -Aqm 'second' We'll see that visitdir works by removing some treemanifest revlogs and running the files command with various parameters. Test files from the root. $ hg files -r . .A/one.txt .A/two.txt b/bar/fruits.txt b/bar/orange/fly/gnat.py b/bar/orange/fly/housefly.txt b/foo/apple/bees/flower.py c.txt d.py Excludes with a glob should not exclude everything from the glob's root $ hg files -r . -X 'b/fo?' b b/bar/fruits.txt b/bar/orange/fly/gnat.py b/bar/orange/fly/housefly.txt $ cp -R .hg/store .hg/store-copy Test files for a subdirectory. #if reporevlogstore $ rm -r .hg/store/meta/~2e_a #endif #if reposimplestore $ rm -r .hg/store/meta/._a #endif $ hg files -r . b b/bar/fruits.txt b/bar/orange/fly/gnat.py b/bar/orange/fly/housefly.txt b/foo/apple/bees/flower.py $ hg diff -r '.^' -r . --stat b b/bar/fruits.txt | 1 + b/bar/orange/fly/gnat.py | 1 + b/bar/orange/fly/housefly.txt | 1 + b/foo/apple/bees/flower.py | 1 + 4 files changed, 4 insertions(+), 0 deletions(-) $ cp -R .hg/store-copy/. .hg/store Test files with just includes and excludes. #if reporevlogstore $ rm -r .hg/store/meta/~2e_a #endif #if reposimplestore $ rm -r .hg/store/meta/._a #endif $ rm -r .hg/store/meta/b/bar/orange/fly $ rm -r .hg/store/meta/b/foo/apple/bees $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees b/bar/fruits.txt $ hg diff -r '.^' -r . --stat -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees b/bar/fruits.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) $ cp -R .hg/store-copy/. .hg/store Test files for a subdirectory, excluding a directory within it. #if reporevlogstore $ rm -r .hg/store/meta/~2e_a #endif #if reposimplestore $ rm -r .hg/store/meta/._a #endif $ rm -r .hg/store/meta/b/foo $ hg files -r . -X path:b/foo b b/bar/fruits.txt b/bar/orange/fly/gnat.py b/bar/orange/fly/housefly.txt $ hg diff -r '.^' -r . --stat -X path:b/foo b b/bar/fruits.txt | 1 + b/bar/orange/fly/gnat.py | 1 + b/bar/orange/fly/housefly.txt | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) $ cp -R .hg/store-copy/. .hg/store Test files for a sub directory, including only a directory within it, and including an unrelated directory. #if reporevlogstore $ rm -r .hg/store/meta/~2e_a #endif #if reposimplestore $ rm -r .hg/store/meta/._a #endif $ rm -r .hg/store/meta/b/foo $ hg files -r . -I path:b/bar/orange -I path:a b b/bar/orange/fly/gnat.py b/bar/orange/fly/housefly.txt $ hg diff -r '.^' -r . --stat -I path:b/bar/orange -I path:a b b/bar/orange/fly/gnat.py | 1 + b/bar/orange/fly/housefly.txt | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) $ cp -R .hg/store-copy/. .hg/store Test files for a pattern, including a directory, and excluding a directory within that. #if reporevlogstore $ rm -r .hg/store/meta/~2e_a #endif #if reposimplestore $ rm -r .hg/store/meta/._a #endif $ rm -r .hg/store/meta/b/foo $ rm -r .hg/store/meta/b/bar/orange $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange b/bar/fruits.txt $ hg diff -r '.^' -r . --stat glob:**.txt -I path:b/bar -X path:b/bar/orange b/bar/fruits.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) $ cp -R .hg/store-copy/. .hg/store Add some more changes to the deep repo $ echo narf >> b/bar/fruits.txt $ hg ci -m narf $ echo troz >> b/bar/orange/fly/gnat.py $ hg ci -m troz Verify works $ hg verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files #if repofncache Dirlogs are included in fncache $ grep meta/.A/00manifest.i .hg/store/fncache meta/.A/00manifest.i Rebuilt fncache includes dirlogs $ rm .hg/store/fncache $ hg debugrebuildfncache adding data/.A/one.txt.i adding data/.A/two.txt.i adding data/b/bar/fruits.txt.i adding data/b/bar/orange/fly/gnat.py.i adding data/b/bar/orange/fly/housefly.txt.i adding data/b/foo/apple/bees/flower.py.i adding data/c.txt.i adding data/d.py.i adding meta/.A/00manifest.i adding meta/b/00manifest.i adding meta/b/bar/00manifest.i adding meta/b/bar/orange/00manifest.i adding meta/b/bar/orange/fly/00manifest.i adding meta/b/foo/00manifest.i adding meta/b/foo/apple/00manifest.i adding meta/b/foo/apple/bees/00manifest.i 16 items added, 0 removed from fncache #endif Finish first server $ killdaemons.py Back up the recently added revlogs $ cp -R .hg/store .hg/store-newcopy Verify reports missing dirlog $ rm .hg/store/meta/b/00manifest.* $ hg verify checking changesets checking manifests checking directory manifests 0: empty or missing b/ b/@0: parent-directory manifest refers to unknown revision 67688a370455 b/@1: parent-directory manifest refers to unknown revision f065da70369e b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b b/@3: parent-directory manifest refers to unknown revision 367152e6af28 warning: orphan data file 'meta/b/bar/00manifest.i' (reporevlogstore !) warning: orphan data file 'meta/b/bar/orange/00manifest.i' (reporevlogstore !) warning: orphan data file 'meta/b/bar/orange/fly/00manifest.i' (reporevlogstore !) warning: orphan data file 'meta/b/foo/00manifest.i' (reporevlogstore !) warning: orphan data file 'meta/b/foo/apple/00manifest.i' (reporevlogstore !) warning: orphan data file 'meta/b/foo/apple/bees/00manifest.i' (reporevlogstore !) crosschecking files in changesets and manifests b/bar/fruits.txt@0: in changeset but not in manifest b/bar/orange/fly/gnat.py@0: in changeset but not in manifest b/bar/orange/fly/housefly.txt@0: in changeset but not in manifest b/foo/apple/bees/flower.py@0: in changeset but not in manifest checking files checked 4 changesets with 18 changes to 8 files 6 warnings encountered! (reporevlogstore !) 9 integrity errors encountered! (first damaged changeset appears to be 0) [1] $ cp -R .hg/store-newcopy/. .hg/store Verify reports missing dirlog entry $ mv -f .hg/store-copy/meta/b/00manifest.* .hg/store/meta/b/ $ hg verify checking changesets checking manifests checking directory manifests b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b b/@3: parent-directory manifest refers to unknown revision 367152e6af28 b/bar/@?: rev 2 points to unexpected changeset 2 b/bar/@?: 44d7e1146e0d not in parent-directory manifest b/bar/@?: rev 3 points to unexpected changeset 3 b/bar/@?: 70b10c6b17b7 not in parent-directory manifest b/bar/orange/@?: rev 2 points to unexpected changeset 3 (expected None) b/bar/orange/fly/@?: rev 2 points to unexpected changeset 3 (expected None) crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files 2 warnings encountered! 8 integrity errors encountered! (first damaged changeset appears to be 2) [1] $ cp -R .hg/store-newcopy/. .hg/store Test cloning a treemanifest repo over http. $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log $ cat hg.pid >> $DAEMON_PIDS $ cd .. We can clone even with the knob turned off and we'll get a treemanifest repo. $ hg clone --config experimental.treemanifest=False \ > --config experimental.changegroup3=True \ > http://localhost:$HGPORT deepclone requesting all changes adding changesets adding manifests adding file changes added 4 changesets with 18 changes to 8 files new changesets 775704be6f52:523e5c631710 updating to branch default 8 files updated, 0 files merged, 0 files removed, 0 files unresolved No server errors. $ cat deeprepo/errors.log requires got updated to include treemanifest $ cat deepclone/.hg/requires | grep treemanifest treemanifest Tree manifest revlogs exist. $ find deepclone/.hg/store/meta | sort deepclone/.hg/store/meta deepclone/.hg/store/meta/._a (reposimplestore !) deepclone/.hg/store/meta/._a/00manifest.i (reposimplestore !) deepclone/.hg/store/meta/b deepclone/.hg/store/meta/b/00manifest.i deepclone/.hg/store/meta/b/bar deepclone/.hg/store/meta/b/bar/00manifest.i deepclone/.hg/store/meta/b/bar/orange deepclone/.hg/store/meta/b/bar/orange/00manifest.i deepclone/.hg/store/meta/b/bar/orange/fly deepclone/.hg/store/meta/b/bar/orange/fly/00manifest.i deepclone/.hg/store/meta/b/foo deepclone/.hg/store/meta/b/foo/00manifest.i deepclone/.hg/store/meta/b/foo/apple deepclone/.hg/store/meta/b/foo/apple/00manifest.i deepclone/.hg/store/meta/b/foo/apple/bees deepclone/.hg/store/meta/b/foo/apple/bees/00manifest.i deepclone/.hg/store/meta/~2e_a (reporevlogstore !) deepclone/.hg/store/meta/~2e_a/00manifest.i (reporevlogstore !) Verify passes. $ cd deepclone $ hg verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files $ cd .. #if reporevlogstore Create clones using old repo formats to use in later tests $ hg clone --config format.usestore=False \ > --config experimental.changegroup3=True \ > http://localhost:$HGPORT deeprepo-basicstore requesting all changes adding changesets adding manifests adding file changes added 4 changesets with 18 changes to 8 files new changesets 775704be6f52:523e5c631710 updating to branch default 8 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd deeprepo-basicstore $ grep store .hg/requires [1] $ hg serve -p $HGPORT1 -d --pid-file=hg.pid --errorlog=errors.log $ cat hg.pid >> $DAEMON_PIDS $ cd .. $ hg clone --config format.usefncache=False \ > --config experimental.changegroup3=True \ > http://localhost:$HGPORT deeprepo-encodedstore requesting all changes adding changesets adding manifests adding file changes added 4 changesets with 18 changes to 8 files new changesets 775704be6f52:523e5c631710 updating to branch default 8 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd deeprepo-encodedstore $ grep fncache .hg/requires [1] $ hg serve -p $HGPORT2 -d --pid-file=hg.pid --errorlog=errors.log $ cat hg.pid >> $DAEMON_PIDS $ cd .. Local clone with basicstore $ hg clone -U deeprepo-basicstore local-clone-basicstore $ hg -R local-clone-basicstore verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files Local clone with encodedstore $ hg clone -U deeprepo-encodedstore local-clone-encodedstore $ hg -R local-clone-encodedstore verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files Local clone with fncachestore $ hg clone -U deeprepo local-clone-fncachestore $ hg -R local-clone-fncachestore verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files Stream clone with basicstore $ hg clone --config experimental.changegroup3=True --stream -U \ > http://localhost:$HGPORT1 stream-clone-basicstore streaming all changes 21 files to transfer, * of data (glob) transferred * in * seconds (*) (glob) $ hg -R stream-clone-basicstore verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files Stream clone with encodedstore $ hg clone --config experimental.changegroup3=True --stream -U \ > http://localhost:$HGPORT2 stream-clone-encodedstore streaming all changes 21 files to transfer, * of data (glob) transferred * in * seconds (*) (glob) $ hg -R stream-clone-encodedstore verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files Stream clone with fncachestore $ hg clone --config experimental.changegroup3=True --stream -U \ > http://localhost:$HGPORT stream-clone-fncachestore streaming all changes 22 files to transfer, * of data (glob) transferred * in * seconds (*) (glob) $ hg -R stream-clone-fncachestore verify checking changesets checking manifests checking directory manifests crosschecking files in changesets and manifests checking files checked 4 changesets with 18 changes to 8 files Packed bundle $ hg -R deeprepo debugcreatestreamclonebundle repo-packed.hg writing 5330 bytes for 18 files bundle requirements: generaldelta, revlogv1, sparserevlog, treemanifest $ hg debugbundle --spec repo-packed.hg none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog%2Ctreemanifest #endif Bundle with changegroup2 is not supported $ hg -R deeprepo bundle --all -t v2 deeprepo.bundle abort: repository does not support bundle version 02 [255] Pull does not include changegroup for manifest the client already has from other branch $ mkdir grafted-dir-repo $ cd grafted-dir-repo $ hg --config experimental.treemanifest=1 init $ mkdir dir $ echo a > dir/file $ echo a > file $ hg ci -Am initial adding dir/file adding file $ echo b > dir/file $ hg ci -m updated $ hg co '.^' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg revert -r tip dir/ reverting dir/file $ echo b > file # to make sure root manifest is sent $ hg ci -m grafted created new head $ cd .. $ hg --config experimental.treemanifest=1 clone --pull -r 1 \ > grafted-dir-repo grafted-dir-repo-clone adding changesets adding manifests adding file changes added 2 changesets with 3 changes to 2 files new changesets d84f4c419457:09ab742f3b0f updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd grafted-dir-repo-clone $ hg pull -r 2 pulling from $TESTTMP/grafted-dir-repo searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) new changesets 73699489fb7c (run 'hg heads' to see heads, 'hg merge' to merge) Committing a empty commit does not duplicate root treemanifest $ echo z >> z $ hg commit -Aqm 'pre-empty commit' $ hg rm z $ hg commit --amend -m 'empty commit' saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-9e3b6b02-amend.hg $ hg log -r 'tip + tip^' -T '{manifest}\n' 1:678d3574b88c 1:678d3574b88c $ hg --config extensions.strip= strip -r . -q