##// END OF EJS Templates
interfaces: convert `repository.irevisiondelta` from zope `Attribute` attrs...
interfaces: convert `repository.irevisiondelta` from zope `Attribute` attrs This is the same transformation as b455dfddfed0 did for dirstate.

File last commit:

r53060:7346f93b default
r53366:2aada52e default
Show More
test-repo-compengines.t
226 lines | 6.0 KiB | text/troff | Tads3Lexer
/ tests / test-repo-compengines.t
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818 A new repository uses zlib storage, which doesn't need a requirement
test: explicitly use zlib compression in tests/test-repo-compengines.t...
r47607 $ cat << EOF >> $HGRCPATH
> [format]
> # stabilize test accross variant
> revlog-compression=zlib
> EOF
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818 $ hg init default
$ cd default
test: simpler requirements matching in test-repo-compengines.t...
r49508 $ hg debugrequires | grep compression
[1]
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818
$ touch foo
$ hg -q commit -A -m 'initial commit with a lot of repeated repeated repeated text to trigger compression'
$ hg debugrevlog -c | grep 0x78
0x78 (x) : 1 (100.00%)
0x78 (x) : 110 (100.00%)
$ cd ..
Unknown compression engine to format.compression aborts
compression: introduce an official `format.revlog-compression` option...
r42213 $ hg --config format.revlog-compression=unknown init unknown
revlog-compression: update the config to be a list...
r44866 abort: compression engines "unknown" defined by format.revlog-compression not available
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818 (run "hg debuginstall" to list available compression engines)
[255]
revlog-compression: update the config to be a list...
r44866 unknown compression engine in a list with known one works fine
$ hg --config format.revlog-compression=zlib,unknown init zlib-before-unknow
$ hg --config format.revlog-compression=unknown,zlib init unknown-before-zlib
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818 A requirement specifying an unknown compression engine results in bail
$ hg init unknownrequirement
$ cd unknownrequirement
$ echo exp-compression-unknown >> .hg/requires
$ hg log
Martin von Zweigbergk
errors: remove trailing "!" from some error messages for consistency...
r46518 abort: repository requires features unknown to this Mercurial: exp-compression-unknown
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
[255]
$ cd ..
Joerg Sonnenberger
revlog: support none compression...
r46737 Specifying a new format.compression on an existing repo won't introduce data
with that engine or a requirement
$ cd default
$ touch bar
$ hg --config format.revlog-compression=none -q commit -A -m 'add bar with a lot of repeated repeated repeated text'
test: simpler requirements matching in test-repo-compengines.t...
r49508 $ hg debugrequires | grep compression
[1]
Joerg Sonnenberger
revlog: support none compression...
r46737
$ hg debugrevlog -c | grep 0x78
0x78 (x) : 2 (100.00%)
0x78 (x) : 199 (100.00%)
$ cd ..
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818 #if zstd
compression: introduce an official `format.revlog-compression` option...
r42213 $ hg --config format.revlog-compression=zstd init zstd
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818 $ cd zstd
test: simpler requirements matching in test-repo-compengines.t...
r49508 $ hg debugrequires | grep compression
compression: introduce an official `zstd-revlog` requirement...
r42305 revlog-compression-zstd
Gregory Szorc
localrepo: experimental support for non-zlib revlog compression...
r30818
$ touch foo
$ hg -q commit -A -m 'initial commit with a lot of repeated repeated repeated text'
$ hg debugrevlog -c | grep 0x28
0x28 : 1 (100.00%)
0x28 : 98 (100.00%)
$ cd ..
#endif
compression: introduce a `storage.revlog.zlib.level` configuration...
r42210
checking zlib options
=====================
$ hg init zlib-level-default
$ hg init zlib-level-1
$ cat << EOF >> zlib-level-1/.hg/hgrc
> [storage]
> revlog.zlib.level=1
> EOF
$ hg init zlib-level-9
$ cat << EOF >> zlib-level-9/.hg/hgrc
> [storage]
> revlog.zlib.level=9
> EOF
$ commitone() {
> repo=$1
> cp $RUNTESTDIR/bundles/issue4438-r1.hg $repo/a
> hg -R $repo add $repo/a
> hg -R $repo commit -m some-commit
> }
$ for repo in zlib-level-default zlib-level-1 zlib-level-9; do
> commitone $repo
> done
$ $RUNTESTDIR/f -s */.hg/store/data/*
Joerg Sonnenberger
revlog: support none compression...
r46737 default/.hg/store/data/bar.i: size=64
default/.hg/store/data/foo.i: size=64
compression: introduce a `storage.revlog.zlib.level` configuration...
r42210 zlib-level-1/.hg/store/data/a.i: size=4146
zlib-level-9/.hg/store/data/a.i: size=4138
zlib-level-default/.hg/store/data/a.i: size=4138
Joerg Sonnenberger
revlog: support none compression...
r46737 zstd/.hg/store/data/foo.i: size=64 (zstd !)
compression: introduce a `storage.revlog.zlib.level` configuration...
r42210
Test error cases
$ hg init zlib-level-invalid
$ cat << EOF >> zlib-level-invalid/.hg/hgrc
> [storage]
> revlog.zlib.level=foobar
> EOF
$ commitone zlib-level-invalid
Martin von Zweigbergk
errors: raise ConfigError on failure to parse config file...
r46506 config error: storage.revlog.zlib.level is not a valid integer ('foobar')
config error: storage.revlog.zlib.level is not a valid integer ('foobar')
Martin von Zweigbergk
errors: set detailed exit code to 30 for config errors...
r46445 [30]
compression: introduce a `storage.revlog.zlib.level` configuration...
r42210
$ hg init zlib-level-out-of-range
$ cat << EOF >> zlib-level-out-of-range/.hg/hgrc
> [storage]
> revlog.zlib.level=42
> EOF
$ commitone zlib-level-out-of-range
abort: invalid value for `storage.revlog.zlib.level` config: 42
abort: invalid value for `storage.revlog.zlib.level` config: 42
[255]
Joerg Sonnenberger
revlog: support none compression...
r46737 checking details of none compression
====================================
$ hg init none-compression --config format.revlog-compression=none
$ commitone() {
> repo=$1
> cp $RUNTESTDIR/bundles/issue4438-r1.hg $repo/a
> hg -R $repo add $repo/a
> hg -R $repo commit -m some-commit
> }
$ commitone none-compression
$ hg log -R none-compression
changeset: 0:68b53da39cd8
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: some-commit
test: simpler requirements matching in test-repo-compengines.t...
r49508 $ hg debugrequires -R none-compression/ | grep compression
Joerg Sonnenberger
revlog: support none compression...
r46737 exp-compression-none
$ $RUNTESTDIR/f -s none-compression/.hg/store/data/*
none-compression/.hg/store/data/a.i: size=4216
test: properly gate a zstd section...
r42537 #if zstd
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211 checking zstd options
=====================
compression: introduce an official `format.revlog-compression` option...
r42213 $ hg init zstd-level-default --config format.revlog-compression=zstd
$ hg init zstd-level-1 --config format.revlog-compression=zstd
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211 $ cat << EOF >> zstd-level-1/.hg/hgrc
> [storage]
> revlog.zstd.level=1
> EOF
compression: introduce an official `format.revlog-compression` option...
r42213 $ hg init zstd-level-22 --config format.revlog-compression=zstd
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211 $ cat << EOF >> zstd-level-22/.hg/hgrc
> [storage]
> revlog.zstd.level=22
> EOF
$ commitone() {
> repo=$1
> cp $RUNTESTDIR/bundles/issue4438-r1.hg $repo/a
> hg -R $repo add $repo/a
> hg -R $repo commit -m some-commit
> }
$ for repo in zstd-level-default zstd-level-1 zstd-level-22; do
> commitone $repo
> done
$ $RUNTESTDIR/f -s zstd-*/.hg/store/data/*
Raphaël Gomès
revlog: add the glue to use the Rust `InnerRevlog` from Python...
r53060 zstd-level-1/.hg/store/data/a.i: size=4114 (no-rust !)
zstd-level-1/.hg/store/data/a.i: size=4112 (rust !)
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211 zstd-level-22/.hg/store/data/a.i: size=4091
Raphaël Gomès
revlog: add the glue to use the Rust `InnerRevlog` from Python...
r53060 zstd-level-default/\.hg/store/data/a\.i: size=(4094|4102) (re) (no-rust !)
zstd-level-default/.hg/store/data/a.i: size=4097 (rust !)
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211
Test error cases
compression: introduce an official `format.revlog-compression` option...
r42213 $ hg init zstd-level-invalid --config format.revlog-compression=zstd
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211 $ cat << EOF >> zstd-level-invalid/.hg/hgrc
> [storage]
> revlog.zstd.level=foobar
> EOF
$ commitone zstd-level-invalid
Martin von Zweigbergk
errors: raise ConfigError on failure to parse config file...
r46506 config error: storage.revlog.zstd.level is not a valid integer ('foobar')
config error: storage.revlog.zstd.level is not a valid integer ('foobar')
Martin von Zweigbergk
errors: set detailed exit code to 30 for config errors...
r46445 [30]
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211
compression: introduce an official `format.revlog-compression` option...
r42213 $ hg init zstd-level-out-of-range --config format.revlog-compression=zstd
compression: introduce a `storage.revlog.zstd.level` configuration...
r42211 $ cat << EOF >> zstd-level-out-of-range/.hg/hgrc
> [storage]
> revlog.zstd.level=42
> EOF
$ commitone zstd-level-out-of-range
abort: invalid value for `storage.revlog.zstd.level` config: 42
abort: invalid value for `storage.revlog.zstd.level` config: 42
[255]
test: properly gate a zstd section...
r42537 #endif