tests/test-repo-compengines.t
author Martin von Zweigbergk <martinvonz@google.com>
Tue, 12 Jan 2021 09:02:47 -0800
changeset 46296 eec8899407f4
parent 46121 84130fd74a22
child 46848 19747c07ed3f
permissions -rw-r--r--
shelve: also create class representing whole directory of shelves It's a little annoying to have to create and pass in a vfs into `listshelves()`. This patch attempts to start addressing that by creating a class that represents a directory containing shelves (the directory can be either `.hg/shelved/` or `.hg/shelve-backup/`). Differential Revision: https://phab.mercurial-scm.org/D9743
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
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  $ hg init default
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  $ cd default
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  $ cat .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  dotencode
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  fncache
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  generaldelta
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  revlogv1
40905
4fe18205bbdb test: enable sparse-revlog for test-repo-compengines.t
Boris Feld <boris.feld@octobus.net>
parents: 37415
diff changeset
    10
  sparserevlog
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  store
37415
c2c8962a9465 simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30818
diff changeset
    12
  testonly-simplestore (reposimplestore !)
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
  $ touch foo
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  $ 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
    16
  $ hg debugrevlog -c | grep 0x78
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
      0x78 (x)  :   1 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
      0x78 (x)  : 110 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
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
    23
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
    24
  $ 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
    25
  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
    26
  (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
    27
  [255]
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
44382
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    29
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
    30
f0027a3dd7cb revlog-compression: update the config to be a list
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42937
diff changeset
    31
  $ 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
    32
  $ 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
    33
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
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
    35
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
  $ hg init unknownrequirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
  $ cd unknownrequirement
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
  $ echo exp-compression-unknown >> .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
  $ hg log
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 45894
diff changeset
    40
  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
    41
  (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
    42
  [255]
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    46
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
    47
with that engine or a requirement
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    48
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    49
  $ cd default
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    50
  $ touch bar
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    51
  $ 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
    52
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    53
  $ cat .hg/requires
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    54
  dotencode
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    55
  fncache
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    56
  generaldelta
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    57
  revlogv1
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    58
  sparserevlog
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    59
  store
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    60
  testonly-simplestore (reposimplestore !)
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    61
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    62
  $ hg debugrevlog -c | grep 0x78
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    63
      0x78 (x)  :   2 (100.00%)
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    64
      0x78 (x)  : 199 (100.00%)
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    65
  $ cd ..
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
    66
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    67
#if zstd
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    68
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
    69
  $ 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
    70
  $ cd zstd
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
  $ cat .hg/requires
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    72
  dotencode
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
  fncache
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
  generaldelta
42136
10a6725dca6e compression: introduce an official `zstd-revlog` requirement
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42046
diff changeset
    75
  revlog-compression-zstd
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
  revlogv1
40905
4fe18205bbdb test: enable sparse-revlog for test-repo-compengines.t
Boris Feld <boris.feld@octobus.net>
parents: 37415
diff changeset
    77
  sparserevlog
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
  store
37415
c2c8962a9465 simplestore: use a custom store for the simple store repo
Gregory Szorc <gregory.szorc@gmail.com>
parents: 30818
diff changeset
    79
  testonly-simplestore (reposimplestore !)
30818
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    80
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    81
  $ touch foo
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    82
  $ 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
    83
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    84
  $ hg debugrevlog -c | grep 0x28
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    85
      0x28      :  1 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    86
      0x28      : 98 (100.00%)
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    87
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    88
  $ cd ..
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    89
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    90
4c0a5a256ae8 localrepo: experimental support for non-zlib revlog compression
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    91
#endif
42043
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    92
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    93
checking zlib options
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
    94
=====================
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
  $ 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
    97
  $ 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
    98
  $ 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
    99
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   100
  > 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
   101
  > EOF
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   102
  $ 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
   103
  $ 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
   104
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   105
  > 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
   106
  > EOF
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
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   109
  $ commitone() {
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   110
  >    repo=$1
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   111
  >    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
   112
  >    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
   113
  >    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
   114
  > }
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
  $ 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
   117
  >     commitone $repo
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   118
  > done
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   119
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   120
  $ $RUNTESTDIR/f -s */.hg/store/data/*
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   121
  default/.hg/store/data/bar.i: size=64
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   122
  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
   123
  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
   124
  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
   125
  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
   126
  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
   127
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   128
Test error cases
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   129
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   130
  $ 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
   131
  $ 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
   132
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   133
  > 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
   134
  > EOF
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   135
  $ 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
   136
  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
   137
  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
   138
  [30]
42043
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   139
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   140
  $ 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
   141
  $ 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
   142
  > [storage]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   143
  > 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
   144
  > EOF
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   145
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   146
  $ 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
   147
  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
   148
  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
   149
  [255]
1fac9b931d46 compression: introduce a `storage.revlog.zlib.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 40919
diff changeset
   150
46121
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   151
checking details of 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
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   154
  $ hg init none-compression --config format.revlog-compression=none
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   155
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   156
  $ commitone() {
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   157
  >    repo=$1
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   158
  >    cp $RUNTESTDIR/bundles/issue4438-r1.hg $repo/a
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   159
  >    hg -R $repo add $repo/a
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   160
  >    hg -R $repo commit -m some-commit
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   161
  > }
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   162
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   163
  $ commitone none-compression
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   164
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   165
  $ hg log -R none-compression
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   166
  changeset:   0:68b53da39cd8
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   167
  tag:         tip
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   168
  user:        test
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   169
  date:        Thu Jan 01 00:00:00 1970 +0000
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   170
  summary:     some-commit
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   171
  
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   172
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   173
  $ cat none-compression/.hg/requires
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   174
  dotencode
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   175
  exp-compression-none
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   176
  fncache
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   177
  generaldelta
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   178
  revlogv1
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   179
  sparserevlog
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   180
  store
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   181
  testonly-simplestore (reposimplestore !)
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   182
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   183
  $ $RUNTESTDIR/f -s none-compression/.hg/store/data/*
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   184
  none-compression/.hg/store/data/a.i: size=4216
84130fd74a22 revlog: support none compression
Joerg Sonnenberger <joerg@bec.de>
parents: 45906
diff changeset
   185
42321
624080e8bd9f test: properly gate a zstd section
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42320
diff changeset
   186
#if zstd
624080e8bd9f test: properly gate a zstd section
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42320
diff changeset
   187
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   188
checking zstd options
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   189
=====================
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   190
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   191
  $ 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
   192
  $ 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
   193
  $ 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
   194
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   195
  > 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
   196
  > EOF
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   197
  $ 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
   198
  $ 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
   199
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   200
  > 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
   201
  > EOF
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   202
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   203
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   204
  $ commitone() {
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   205
  >    repo=$1
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   206
  >    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
   207
  >    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
   208
  >    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
   209
  > }
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   210
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   211
  $ 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
   212
  >     commitone $repo
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   213
  > done
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   214
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   215
  $ $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
   216
  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
   217
  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
   218
  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
   219
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   220
Test error cases
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   221
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   222
  $ 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
   223
  $ 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
   224
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   225
  > 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
   226
  > EOF
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   227
  $ 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
   228
  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
   229
  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
   230
  [30]
42044
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   231
42046
4ee906aa7b60 compression: introduce an official `format.revlog-compression` option
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42044
diff changeset
   232
  $ 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
   233
  $ 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
   234
  > [storage]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   235
  > 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
   236
  > EOF
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   237
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   238
  $ 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
   239
  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
   240
  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
   241
  [255]
bb271ec2fbfb compression: introduce a `storage.revlog.zstd.level` configuration
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42043
diff changeset
   242
42321
624080e8bd9f test: properly gate a zstd section
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42320
diff changeset
   243
#endif