tests/test-repo-compengines.t
author Raphaël Gomès <rgomes@octobus.net>
Wed, 04 May 2022 18:17:44 +0200
changeset 49164 a932cad26d37
parent 48662 d7135d8e8998
child 52167 7346f93be7a4
permissions -rw-r--r--
branching: merge stable into default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
A new repository uses zlib storage, which doesn't need a requirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
46848
19747c07ed3f test: explicitly use zlib compression in tests/test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46121
diff changeset
     3
  $ cat << EOF >> $HGRCPATH
19747c07ed3f test: explicitly use zlib compression in tests/test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46121
diff changeset
     4
  > [format]
19747c07ed3f test: explicitly use zlib compression in tests/test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46121
diff changeset
     5
  > # stabilize test accross variant
19747c07ed3f test: explicitly use zlib compression in tests/test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46121
diff changeset
     6
  > revlog-compression=zlib
19747c07ed3f test: explicitly use zlib compression in tests/test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46121
diff changeset
     7
  > EOF
19747c07ed3f test: explicitly use zlib compression in tests/test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46121
diff changeset
     8
19747c07ed3f test: explicitly use zlib compression in tests/test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46121
diff changeset
     9
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
  $ hg init default
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  $ cd default
48662
d7135d8e8998 test: simpler requirements matching in test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    12
  $ hg debugrequires | grep compression
d7135d8e8998 test: simpler requirements matching in test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    13
  [1]
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  $ touch foo
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  $ hg -q commit -A -m 'initial commit with a lot of repeated repeated repeated text to trigger compression'
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  $ hg debugrevlog -c | grep 0x78
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
      0x78 (x)  :   1 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
      0x78 (x)  : 110 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
Unknown compression engine to format.compression aborts
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
    25
  $ hg --config format.revlog-compression=unknown init unknown
44382
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    26
  abort: compression engines "unknown" defined by format.revlog-compression not available
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
  (run "hg debuginstall" to list available compression engines)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
  [255]
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
44382
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    30
unknown compression engine in a list with known one works fine
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    31
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    32
  $ hg --config format.revlog-compression=zlib,unknown init zlib-before-unknow
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    33
  $ hg --config format.revlog-compression=unknown,zlib init unknown-before-zlib
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    34
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
A requirement specifying an unknown compression engine results in bail
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
  $ hg init unknownrequirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
  $ cd unknownrequirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
  $ echo exp-compression-unknown >> .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    40
  $ hg log
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 45894
diff changeset
    41
  abort: repository requires features unknown to this Mercurial: exp-compression-unknown
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    42
  (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  [255]
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    46
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    47
Specifying a new format.compression on an existing repo won't introduce data
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    48
with that engine or a requirement
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    49
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    50
  $ cd default
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    51
  $ touch bar
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    52
  $ hg --config format.revlog-compression=none -q commit -A -m 'add bar with a lot of repeated repeated repeated text'
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    53
48662
d7135d8e8998 test: simpler requirements matching in test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    54
  $ hg debugrequires | grep compression
d7135d8e8998 test: simpler requirements matching in test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    55
  [1]
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    56
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    57
  $ hg debugrevlog -c | grep 0x78
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    58
      0x78 (x)  :   2 (100.00%)
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    59
      0x78 (x)  : 199 (100.00%)
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    60
  $ cd ..
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    61
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
#if zstd
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
    64
  $ hg --config format.revlog-compression=zstd init zstd
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
  $ cd zstd
48662
d7135d8e8998 test: simpler requirements matching in test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    66
  $ hg debugrequires | grep compression
42136
10a6725dca6e compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42046
diff changeset
    67
  revlog-compression-zstd
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    68
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    69
  $ touch foo
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    70
  $ hg -q commit -A -m 'initial commit with a lot of repeated repeated repeated text'
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    72
  $ hg debugrevlog -c | grep 0x28
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
      0x28      :  1 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
      0x28      : 98 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    75
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    77
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    79
#endif
42043
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    80
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    81
checking zlib options
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    82
=====================
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    83
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    84
  $ hg init zlib-level-default
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    85
  $ hg init zlib-level-1
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    86
  $ cat << EOF >> zlib-level-1/.hg/hgrc
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    87
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    88
  > revlog.zlib.level=1
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    89
  > EOF
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    90
  $ hg init zlib-level-9
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    91
  $ cat << EOF >> zlib-level-9/.hg/hgrc
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    92
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    93
  > revlog.zlib.level=9
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    94
  > EOF
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    95
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    96
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    97
  $ commitone() {
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    98
  >    repo=$1
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    99
  >    cp $RUNTESTDIR/bundles/issue4438-r1.hg $repo/a
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   100
  >    hg -R $repo add $repo/a
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   101
  >    hg -R $repo commit -m some-commit
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   102
  > }
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   103
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   104
  $ for repo in zlib-level-default zlib-level-1 zlib-level-9; do
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   105
  >     commitone $repo
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   106
  > done
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   107
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   108
  $ $RUNTESTDIR/f -s */.hg/store/data/*
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   109
  default/.hg/store/data/bar.i: size=64
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   110
  default/.hg/store/data/foo.i: size=64
42043
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   111
  zlib-level-1/.hg/store/data/a.i: size=4146
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   112
  zlib-level-9/.hg/store/data/a.i: size=4138
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   113
  zlib-level-default/.hg/store/data/a.i: size=4138
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   114
  zstd/.hg/store/data/foo.i: size=64 (zstd !)
42043
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   115
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   116
Test error cases
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   117
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   118
  $ hg init zlib-level-invalid
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   119
  $ cat << EOF >> zlib-level-invalid/.hg/hgrc
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   120
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   121
  > revlog.zlib.level=foobar
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   122
  > EOF
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   123
  $ commitone zlib-level-invalid
45894
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45841
diff changeset
   124
  config error: storage.revlog.zlib.level is not a valid integer ('foobar')
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45841
diff changeset
   125
  config error: storage.revlog.zlib.level is not a valid integer ('foobar')
45841
bff719525815 errors: set detailed exit code to 30 for config errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 44382
diff changeset
   126
  [30]
42043
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   127
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   128
  $ hg init zlib-level-out-of-range
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   129
  $ cat << EOF >> zlib-level-out-of-range/.hg/hgrc
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   130
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   131
  > revlog.zlib.level=42
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   132
  > EOF
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   133
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   134
  $ commitone zlib-level-out-of-range
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   135
  abort: invalid value for `storage.revlog.zlib.level` config: 42
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   136
  abort: invalid value for `storage.revlog.zlib.level` config: 42
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   137
  [255]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   138
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   139
checking details of none compression
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   140
====================================
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   141
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   142
  $ hg init none-compression --config format.revlog-compression=none
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   143
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   144
  $ commitone() {
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   145
  >    repo=$1
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   146
  >    cp $RUNTESTDIR/bundles/issue4438-r1.hg $repo/a
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   147
  >    hg -R $repo add $repo/a
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   148
  >    hg -R $repo commit -m some-commit
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   149
  > }
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   150
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   151
  $ commitone none-compression
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   152
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   153
  $ hg log -R none-compression
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   154
  changeset:   0:68b53da39cd8
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   155
  tag:         tip
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   156
  user:        test
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   157
  date:        Thu Jan 01 00:00:00 1970 +0000
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   158
  summary:     some-commit
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   159
  
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   160
48662
d7135d8e8998 test: simpler requirements matching in test-repo-compengines.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
   161
  $ hg debugrequires -R none-compression/ | grep compression
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   162
  exp-compression-none
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   163
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   164
  $ $RUNTESTDIR/f -s none-compression/.hg/store/data/*
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   165
  none-compression/.hg/store/data/a.i: size=4216
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   166
42321
624080e8bd9f test: properly gate a zstd section
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42320
diff changeset
   167
#if zstd
624080e8bd9f test: properly gate a zstd section
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42320
diff changeset
   168
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   169
checking zstd options
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   170
=====================
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   171
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   172
  $ hg init zstd-level-default --config format.revlog-compression=zstd
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   173
  $ hg init zstd-level-1 --config format.revlog-compression=zstd
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   174
  $ cat << EOF >> zstd-level-1/.hg/hgrc
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   175
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   176
  > revlog.zstd.level=1
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   177
  > EOF
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   178
  $ hg init zstd-level-22 --config format.revlog-compression=zstd
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   179
  $ cat << EOF >> zstd-level-22/.hg/hgrc
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   180
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   181
  > revlog.zstd.level=22
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   182
  > EOF
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   183
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   184
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   185
  $ commitone() {
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   186
  >    repo=$1
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   187
  >    cp $RUNTESTDIR/bundles/issue4438-r1.hg $repo/a
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   188
  >    hg -R $repo add $repo/a
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   189
  >    hg -R $repo commit -m some-commit
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   190
  > }
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   191
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   192
  $ for repo in zstd-level-default zstd-level-1 zstd-level-22; do
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   193
  >     commitone $repo
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   194
  > done
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   195
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   196
  $ $RUNTESTDIR/f -s zstd-*/.hg/store/data/*
42937
69de49c4e39c zstandard: vendor python-zstandard 0.12
Gregory Szorc <gregory.szorc@gmail.com>
parents: 42847
diff changeset
   197
  zstd-level-1/.hg/store/data/a.i: size=4114
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   198
  zstd-level-22/.hg/store/data/a.i: size=4091
42847
da2c360899c9 test: allow different result for zstd compression (issue6188)
Julien Cristau <jcristau@debian.org>
parents: 42321
diff changeset
   199
  zstd-level-default/\.hg/store/data/a\.i: size=(4094|4102) (re)
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   200
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   201
Test error cases
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   202
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   203
  $ hg init zstd-level-invalid --config format.revlog-compression=zstd
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   204
  $ cat << EOF >> zstd-level-invalid/.hg/hgrc
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   205
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   206
  > revlog.zstd.level=foobar
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   207
  > EOF
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   208
  $ commitone zstd-level-invalid
45894
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45841
diff changeset
   209
  config error: storage.revlog.zstd.level is not a valid integer ('foobar')
9dc1351d0b5f errors: raise ConfigError on failure to parse config file
Martin von Zweigbergk <martinvonz@google.com>
parents: 45841
diff changeset
   210
  config error: storage.revlog.zstd.level is not a valid integer ('foobar')
45841
bff719525815 errors: set detailed exit code to 30 for config errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 44382
diff changeset
   211
  [30]
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   212
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   213
  $ hg init zstd-level-out-of-range --config format.revlog-compression=zstd
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   214
  $ cat << EOF >> zstd-level-out-of-range/.hg/hgrc
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   215
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   216
  > revlog.zstd.level=42
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   217
  > EOF
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   218
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   219
  $ commitone zstd-level-out-of-range
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   220
  abort: invalid value for `storage.revlog.zstd.level` config: 42
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   221
  abort: invalid value for `storage.revlog.zstd.level` config: 42
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   222
  [255]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   223
42321
624080e8bd9f test: properly gate a zstd section
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42320
diff changeset
   224
#endif