Mercurial > hg
view tests/test-backout.t @ 42044:bb271ec2fbfb
compression: introduce a `storage.revlog.zstd.level` configuration
This option control the zstd compression level used when compressing revlog
chunk. The usage of zstd for revlog compression has not graduated from
experimental yet, but we intend to fix that soon.
The option name for the compression level is more straight forward to pick, so
this changesets comes first. Having a dedicated option for each compression
engine is useful because they don't support the same range of values.
I ran the same measurement as for the zlib compression level (in the parent
changesets). The variation in repository size is stay mostly in the same (small)
range. The "read/write" performance see smallish variation, but are overall much
better than zlib. Write performance show the same tend of having better write
performance for when reaching high-end compression.
Again, we don't intend to change the default zstd compression level (currently:
3) in this series. However this is worth investigating in the future.
The Performance comparison of zlib vs zstd is quite impressive. The repository
size stay in the same range, but the performance are much better in all
situations.
Comparison summary
==================
We are looking at:
- performance range for zlib
- performance range for zstd
- comparison of default zstd (level-3) to default zlib (level 6)
- comparison of the slowest zstd time to the fastest zlib time
Read performance:
-----------------
| zlib | zstd | cmp | f2s
mercurial | 0.170159 - 0.189219 | 0.144127 - 0.149624 | 80% | 88%
pypy | 2.679217 - 2.768691 | 1.532317 - 1.705044 | 60% | 63%
netbeans | 122.477027 - 141.620281 | 72.996346 - 89.731560 | 58% | 73%
mozilla | 147.867662 - 170.572118 | 91.700995 - 105.853099 | 56% | 71%
Write performance:
------------------
| zlib | zstd | cmp | f2s
mercurial | 53.250304 - 56.2936129 | 40.877025 - 45.677286 | 75% | 86%
pypy | 460.721984 - 476.589918 | 270.545409 - 301.002219 | 63% | 65%
netbeans | 520.560316 - 715.930400 | 370.356311 - 428.329652 | 55% | 82%
mozilla | 739.803002 - 987.056093 | 505.152906 - 591.930683 | 57% | 80%
Raw data
--------
repo alg lvl .hg/store size 00manifest.d read write
mercurial zlib 1 49,402,813 5,963,475 0.170159 53.250304
mercurial zlib 6 47,197,397 5,875,730 0.182820 56.264320
mercurial zlib 9 47,121,596 5,849,781 0.189219 56.293612
mercurial zstd 1 49,737,084 5,966,355 0.144127 40.877025
mercurial zstd 3 48,961,867 5,895,208 0.146376 42.268142
mercurial zstd 5 48,200,592 5,938,676 0.149624 43.162875
mercurial zstd 10 47,833,520 5,913,353 0.145185 44.012489
mercurial zstd 15 47,314,604 5,728,679 0.147686 45.677286
mercurial zstd 20 47,330,502 5,830,539 0.145789 45.025407
mercurial zstd 22 47,330,076 5,830,539 0.143996 44.690460
pypy zlib 1 370,830,572 28,462,425 2.679217 460.721984
pypy zlib 6 340,112,317 27,648,747 2.768691 467.537158
pypy zlib 9 338,360,736 27,639,003 2.763495 476.589918
pypy zstd 1 362,377,479 27,916,214 1.532317 270.545409
pypy zstd 3 354,137,693 27,905,988 1.686718 294.951509
pypy zstd 5 342,640,043 27,655,774 1.705044 301.002219
pypy zstd 10 334,224,327 27,164,493 1.567287 285.186239
pypy zstd 15 329,000,363 26,645,965 1.637729 299.561332
pypy zstd 20 324,534,039 26,199,547 1.526813 302.149827
pypy zstd 22 324,530,595 26,198,932 1.525718 307.821218
netbeans zlib 1 1,281,847,810 165,495,457 122.477027 520.560316
netbeans zlib 6 1,205,284,353 159,161,207 139.876147 715.930400
netbeans zlib 9 1,197,135,671 155,034,586 141.620281 678.297064
netbeans zstd 1 1,259,581,737 160,840,613 72.996346 370.356311
netbeans zstd 3 1,232,978,122 157,691,551 81.622317 396.733087
netbeans zstd 5 1,208,034,075 160,246,880 83.080549 364.342626
netbeans zstd 10 1,188,624,176 156,083,417 79.323935 403.594602
netbeans zstd 15 1,176,973,589 153,859,477 89.731560 428.329652
netbeans zstd 20 1,162,958,258 151,147,535 82.842667 392.335349
netbeans zstd 22 1,162,707,029 151,150,220 82.565695 402.840655
mozilla zlib 1 2,775,497,186 298,527,987 147.867662 751.263721
mozilla zlib 6 2,596,856,420 286,597,671 170.572118 987.056093
mozilla zlib 9 2,587,542,494 287,018,264 163.622338 739.803002
mozilla zstd 1 2,723,159,348 286,617,532 91.700995 570.042751
mozilla zstd 3 2,665,055,001 286,152,013 95.240155 561.412805
mozilla zstd 5 2,607,819,817 288,060,030 101.978048 505.152906
mozilla zstd 10 2,558,761,085 283,967,648 104.113481 497.771202
mozilla zstd 15 2,526,216,060 275,581,300 105.853099 591.930683
mozilla zstd 20 2,485,114,806 266,478,859 95.268795 576.515389
mozilla zstd 22 2,484,869,080 266,456,505 94.429282 572.785537
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 27 Mar 2019 18:35:59 +0100 |
parents | 7e99b02768ef |
children | 99ebde4fec99 |
line wrap: on
line source
$ hg init basic $ cd basic should complain $ hg backout abort: please specify a revision to backout [255] $ hg backout -r 0 0 abort: please specify just one revision [255] basic operation (this also tests that editor is invoked if the commit message is not specified explicitly) $ echo a > a $ hg commit -d '0 0' -A -m a adding a $ echo b >> a $ hg commit -d '1 0' -m b $ hg status --rev tip --rev "tip^1" M a $ HGEDITOR=cat hg backout -d '2 0' tip --tool=true reverting a Backed out changeset a820f4f40a57 HG: Enter commit message. Lines beginning with 'HG:' are removed. HG: Leave message empty to abort commit. HG: -- HG: user: test HG: branch 'default' HG: changed a changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57 $ cat a a $ hg summary parent: 2:2929462c3dff tip Backed out changeset a820f4f40a57 branch: default commit: (clean) update: (current) phases: 3 draft commit option $ cd .. $ hg init commit $ cd commit $ echo tomatoes > a $ hg add a $ hg commit -d '0 0' -m tomatoes $ echo chair > b $ hg add b $ hg commit -d '1 0' -m chair $ echo grapes >> a $ hg commit -d '2 0' -m grapes $ hg backout -d '4 0' 1 --tool=:fail 0 files updated, 0 files merged, 1 files removed, 0 files unresolved changeset 3:1c2161e97c0a backs out changeset 1:22cb4f70d813 $ hg summary parent: 3:1c2161e97c0a tip Backed out changeset 22cb4f70d813 branch: default commit: (clean) update: (current) phases: 4 draft $ echo ypples > a $ hg commit -d '5 0' -m ypples $ hg backout -d '6 0' 2 --tool=:fail 0 files updated, 0 files merged, 0 files removed, 1 files unresolved use 'hg resolve' to retry unresolved file merges [1] $ hg summary parent: 4:ed99997b793d tip ypples branch: default commit: 1 unresolved (clean) update: (current) phases: 5 draft file that was removed is recreated (this also tests that editor is not invoked if the commit message is specified explicitly) $ cd .. $ hg init remove $ cd remove $ echo content > a $ hg commit -d '0 0' -A -m a adding a $ hg rm a $ hg commit -d '1 0' -m b $ HGEDITOR=cat hg backout -d '2 0' tip --tool=true -m "Backed out changeset 76862dcce372" adding a changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 $ cat a content $ hg summary parent: 2:de31bdc76c0d tip Backed out changeset 76862dcce372 branch: default commit: (clean) update: (current) phases: 3 draft backout of backout is as if nothing happened $ hg backout -d '3 0' --merge tip --tool=true removing a changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d $ test -f a [1] $ hg summary parent: 3:7f6d0f120113 tip Backed out changeset de31bdc76c0d branch: default commit: (clean) update: (current) phases: 4 draft Test that 'hg rollback' restores dirstate just before opening transaction: in-memory dirstate changes should be written into '.hg/journal.dirstate' as expected. $ echo 'removed soon' > b $ hg commit -A -d '4 0' -m 'prepare for subsequent removing' adding b $ echo 'newly added' > c $ hg add c $ hg remove b $ hg commit -d '5 0' -m 'prepare for subsequent backout' $ touch -t 200001010000 c $ hg status -A C c $ hg debugstate --no-dates n 644 12 set c $ hg backout -d '6 0' -m 'to be rollback-ed soon' -r . removing c adding b changeset 6:4bfec048029d backs out changeset 5:fac0b729a654 $ hg rollback -q $ hg status -A A b R c $ hg debugstate --no-dates a 0 -1 unset b r 0 0 set c across branch $ cd .. $ hg init branch $ cd branch $ echo a > a $ hg ci -Am0 adding a $ echo b > b $ hg ci -Am1 adding b $ hg co -C 0 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg summary parent: 0:f7b1eb17ad24 0 branch: default commit: (clean) update: 1 new changesets (update) phases: 2 draft should fail $ hg backout 1 abort: cannot backout change that is not an ancestor [255] $ echo c > c $ hg ci -Am2 adding c created new head $ hg summary parent: 2:db815d6d32e6 tip 2 branch: default commit: (clean) update: 1 new changesets, 2 branch heads (merge) phases: 3 draft should fail $ hg backout 1 abort: cannot backout change that is not an ancestor [255] $ hg summary parent: 2:db815d6d32e6 tip 2 branch: default commit: (clean) update: 1 new changesets, 2 branch heads (merge) phases: 3 draft backout with merge $ cd .. $ hg init merge $ cd merge $ echo line 1 > a $ echo line 2 >> a $ hg commit -d '0 0' -A -m a adding a $ hg summary parent: 0:59395513a13a tip a branch: default commit: (clean) update: (current) phases: 1 draft remove line 1 $ echo line 2 > a $ hg commit -d '1 0' -m b $ echo line 3 >> a $ hg commit -d '2 0' -m c $ hg backout --merge -d '3 0' 1 --tool=true reverting a created new head changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182 merging with changeset 3:26b8ccb9ad91 merging a 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg commit -d '4 0' -m d $ hg summary parent: 4:c7df5e0b9c09 tip d branch: default commit: (clean) update: (current) phases: 5 draft check line 1 is back $ cat a line 1 line 2 line 3 Test visibility of in-memory dirstate changes outside transaction to external hook process $ cat > $TESTTMP/checkvisibility.sh <<EOF > echo "==== \$1:" > hg parents --template "{rev}:{node|short}\n" > echo "====" > EOF "hg backout --merge REV1" at REV2 below implies steps below: (1) update to REV1 (REV2 => REV1) (2) revert by REV1^1 (3) commit backing out revision (REV3) (4) update to REV2 (REV3 => REV2) (5) merge with REV3 (REV2 => REV2, REV3) == test visibility to external preupdate hook $ hg update -q -C 2 $ hg --config extensions.strip= strip 3 saved backup bundle to * (glob) $ cat >> .hg/hgrc <<EOF > [hooks] > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate > EOF ("-m" is needed to avoid writing dirstate changes out at other than invocation of the hook to be examined) $ hg backout --merge -d '3 0' 1 --tool=true -m 'fixed comment' ==== preupdate: 2:6ea3f2a197a2 ==== reverting a created new head changeset 3:d92a3f57f067 backs out changeset 1:5a50a024c182 ==== preupdate: 3:d92a3f57f067 ==== merging with changeset 3:d92a3f57f067 ==== preupdate: 2:6ea3f2a197a2 ==== merging a 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat >> .hg/hgrc <<EOF > [hooks] > preupdate.visibility = > EOF == test visibility to external update hook $ hg update -q -C 2 $ hg --config extensions.strip= strip 3 saved backup bundle to * (glob) $ cat >> .hg/hgrc <<EOF > [hooks] > update.visibility = sh $TESTTMP/checkvisibility.sh update > EOF $ hg backout --merge -d '3 0' 1 --tool=true -m 'fixed comment' ==== update: 1:5a50a024c182 ==== reverting a created new head changeset 3:d92a3f57f067 backs out changeset 1:5a50a024c182 ==== update: 2:6ea3f2a197a2 ==== merging with changeset 3:d92a3f57f067 merging a ==== update: 2:6ea3f2a197a2 3:d92a3f57f067 ==== 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat >> .hg/hgrc <<EOF > [hooks] > update.visibility = > EOF $ cd .. backout should not back out subsequent changesets $ hg init onecs $ cd onecs $ echo 1 > a $ hg commit -d '0 0' -A -m a adding a $ echo 2 >> a $ hg commit -d '1 0' -m b $ echo 1 > b $ hg commit -d '2 0' -A -m c adding b $ hg summary parent: 2:882396649954 tip c branch: default commit: (clean) update: (current) phases: 3 draft without --merge $ hg backout --no-commit -d '3 0' 1 --tool=true 1 files updated, 0 files merged, 0 files removed, 0 files unresolved changeset 22bca4c721e5 backed out, don't forget to commit. $ hg locate b b $ hg update -C tip 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg locate b b $ hg summary parent: 2:882396649954 tip c branch: default commit: (clean) update: (current) phases: 3 draft with --merge $ hg backout --merge -d '3 0' 1 --tool=true reverting a created new head changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 merging with changeset 3:3202beb76721 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg locate b b $ hg update -C tip 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg locate b [1] $ cd .. $ hg init m $ cd m $ echo a > a $ hg commit -d '0 0' -A -m a adding a $ echo b > b $ hg commit -d '1 0' -A -m b adding b $ echo c > c $ hg commit -d '2 0' -A -m b adding c $ hg update 1 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo d > d $ hg commit -d '3 0' -A -m c adding d created new head $ hg merge 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg commit -d '4 0' -A -m d $ hg summary parent: 4:b2f3bb92043e tip d branch: default commit: (clean) update: (current) phases: 5 draft backout of merge should fail $ hg backout 4 abort: cannot backout a merge changeset [255] backout of merge with bad parent should fail $ hg backout --parent 0 4 abort: cb9a9f314b8b is not a parent of b2f3bb92043e [255] backout of non-merge with parent should fail $ hg backout --parent 0 3 abort: cannot use --parent on non-merge changeset [255] backout with valid parent should be ok $ hg backout -d '5 0' --parent 2 4 --tool=true removing d changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e $ hg summary parent: 5:10e5328c8435 tip Backed out changeset b2f3bb92043e branch: default commit: (clean) update: (current) phases: 6 draft $ hg rollback repository tip rolled back to revision 4 (undo commit) working directory now based on revision 4 $ hg update -C 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg summary parent: 4:b2f3bb92043e tip d branch: default commit: (clean) update: (current) phases: 5 draft $ hg backout -d '6 0' --parent 3 4 --tool=true removing c changeset 5:033590168430 backs out changeset 4:b2f3bb92043e $ hg summary parent: 5:033590168430 tip Backed out changeset b2f3bb92043e branch: default commit: (clean) update: (current) phases: 6 draft $ cd .. named branches $ hg init named_branches $ cd named_branches $ echo default > default $ hg ci -d '0 0' -Am default adding default $ hg branch branch1 marked working directory as branch branch1 (branches are permanent and global, did you want a bookmark?) $ echo branch1 > file1 $ hg ci -d '1 0' -Am file1 adding file1 $ hg branch branch2 marked working directory as branch branch2 $ echo branch2 > file2 $ hg ci -d '2 0' -Am file2 adding file2 without --merge $ hg backout --no-commit -r 1 --tool=true 0 files updated, 0 files merged, 1 files removed, 0 files unresolved changeset bf1602f437f3 backed out, don't forget to commit. $ hg branch branch2 $ hg status -A R file1 C default C file2 $ hg summary parent: 2:45bbcd363bf0 tip file2 branch: branch2 commit: 1 removed update: (current) phases: 3 draft with --merge (this also tests that editor is invoked if '--edit' is specified explicitly regardless of '--message') $ hg update -qC $ HGEDITOR=cat hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true --edit removing file1 backout on branch1 HG: Enter commit message. Lines beginning with 'HG:' are removed. HG: Leave message empty to abort commit. HG: -- HG: user: test HG: branch 'branch2' HG: removed file1 created new head changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3 merging with changeset 3:d4e8f6db59fb 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg summary parent: 2:45bbcd363bf0 file2 parent: 3:d4e8f6db59fb tip backout on branch1 branch: branch2 commit: 1 removed (merge) update: (current) phases: 4 draft $ hg update -q -C 2 on branch2 with branch1 not merged, so file1 should still exist: $ hg id 45bbcd363bf0 (branch2) $ hg st -A C default C file1 C file2 $ hg summary parent: 2:45bbcd363bf0 file2 branch: branch2 commit: (clean) update: 1 new changesets, 2 branch heads (merge) phases: 4 draft on branch2 with branch1 merged, so file1 should be gone: $ hg merge 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -d '4 0' -m 'merge backout of branch1' $ hg id 22149cdde76d (branch2) tip $ hg st -A C default C file2 $ hg summary parent: 4:22149cdde76d tip merge backout of branch1 branch: branch2 commit: (clean) update: (current) phases: 5 draft on branch1, so no file1 and file2: $ hg co -C branch1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg id bf1602f437f3 (branch1) $ hg st -A C default C file1 $ hg summary parent: 1:bf1602f437f3 file1 branch: branch1 commit: (clean) update: (current) phases: 5 draft $ cd .. backout of empty changeset (issue4190) $ hg init emptycommit $ cd emptycommit $ touch file1 $ hg ci -Aqm file1 $ hg branch -q branch1 $ hg ci -qm branch1 $ hg backout -v 1 resolving manifests nothing changed [1] $ cd .. Test usage of `hg resolve` in case of conflict (issue4163) $ hg init issue4163 $ cd issue4163 $ touch foo $ hg add foo $ cat > foo << EOF > one > two > three > four > five > six > seven > height > nine > ten > EOF $ hg ci -m 'initial' $ cat > foo << EOF > one > two > THREE > four > five > six > seven > height > nine > ten > EOF $ hg ci -m 'capital three' $ cat > foo << EOF > one > two > THREE > four > five > six > seven > height > nine > TEN > EOF $ hg ci -m 'capital ten' $ hg backout -r 'desc("capital three")' --tool internal:fail 0 files updated, 0 files merged, 0 files removed, 1 files unresolved use 'hg resolve' to retry unresolved file merges [1] $ hg status $ hg debugmergestate * version 2 records local: b71750c4b0fdf719734971e3ef90dbeab5919a2d other: a30dd8addae3ce71b8667868478542bc417439e6 file extras: foo (ancestorlinknode = 91360952243723bd5b1138d5f26bd8c8564cb553) file: foo (record type "F", state "u", hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33) local path: foo (flags "") ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708) other path: foo (node f50039b486d6fa1a90ae51778388cad161f425ee) $ mv .hg/merge/state2 .hg/merge/state2-moved $ hg debugmergestate * version 1 records local: b71750c4b0fdf719734971e3ef90dbeab5919a2d file: foo (record type "F", state "u", hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33) local path: foo (flags "") ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708) other path: foo (node not stored in v1 format) $ mv .hg/merge/state2-moved .hg/merge/state2 $ hg resolve -l # still unresolved U foo $ hg summary parent: 2:b71750c4b0fd tip capital ten branch: default commit: 1 unresolved (clean) update: (current) phases: 3 draft $ hg resolve --all --debug picked tool ':merge' for foo (binary False symlink False changedelete False) merging foo my foo@b71750c4b0fd+ other foo@a30dd8addae3 ancestor foo@913609522437 premerge successful (no more unresolved files) continue: hg commit $ hg status M foo ? foo.orig $ hg resolve -l R foo $ hg summary parent: 2:b71750c4b0fd tip capital ten branch: default commit: 1 modified, 1 unknown update: (current) phases: 3 draft $ cat foo one two three four five six seven height nine TEN --no-commit shouldn't commit $ hg init a $ cd a $ for i in 1 2 3; do > touch $i > hg ci -Am $i > done adding 1 adding 2 adding 3 $ hg backout --no-commit . removing 3 changeset cccc23d9d68f backed out, don't forget to commit. $ hg revert -aq --no-commit can't be used with --merge $ hg backout --merge --no-commit 2 abort: cannot use --merge with --no-commit [255]