changeset 46121:84130fd74a22

revlog: support none compression revlog files had uncompressed revlog entries support since forever, but it wasn't selectable or exposed explicitly. It is occassionally useful for performance testing as it avoids the latency of zlib or zstd. It also has the nice side effect of providing a non-default compression engine out-of-the-box. Differential Revision: https://phab.mercurial-scm.org/D9572
author Joerg Sonnenberger <joerg@bec.de>
date Sun, 13 Dec 2020 00:19:03 +0100
parents c000eff2c635
children 1b5aeb928c8f
files mercurial/utils/compression.py tests/test-repo-compengines.t
diffstat 2 files changed, 63 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/compression.py	Thu Nov 12 10:41:03 2020 -0800
+++ b/mercurial/utils/compression.py	Sun Dec 13 00:19:03 2020 +0100
@@ -617,8 +617,10 @@
     def wireprotosupport(self):
         return compewireprotosupport(b'none', 0, 10)
 
-    # We don't implement revlogheader because it is handled specially
-    # in the revlog class.
+    # revlog special cases the uncompressed case, but implementing
+    # revlogheader allows forcing uncompressed storage.
+    def revlogheader(self):
+        return b'\0'
 
     def compressstream(self, it, opts=None):
         return it
--- a/tests/test-repo-compengines.t	Thu Nov 12 10:41:03 2020 -0800
+++ b/tests/test-repo-compengines.t	Sun Dec 13 00:19:03 2020 +0100
@@ -43,6 +43,27 @@
 
   $ cd ..
 
+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'
+
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+  testonly-simplestore (reposimplestore !)
+
+  $ hg debugrevlog -c | grep 0x78
+      0x78 (x)  :   2 (100.00%)
+      0x78 (x)  : 199 (100.00%)
+  $ cd ..
+
 #if zstd
 
   $ hg --config format.revlog-compression=zstd init zstd
@@ -66,25 +87,6 @@
 
   $ cd ..
 
-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=zstd -q commit -A -m 'add bar with a lot of repeated repeated repeated text'
-
-  $ cat .hg/requires
-  dotencode
-  fncache
-  generaldelta
-  revlogv1
-  sparserevlog
-  store
-  testonly-simplestore (reposimplestore !)
-
-  $ hg debugrevlog -c | grep 0x78
-      0x78 (x)  :   2 (100.00%)
-      0x78 (x)  : 199 (100.00%)
 
 #endif
 
@@ -116,10 +118,12 @@
   > done
 
   $ $RUNTESTDIR/f -s */.hg/store/data/*
-  default/.hg/store/data/foo.i: size=64 (pure !)
+  default/.hg/store/data/bar.i: size=64
+  default/.hg/store/data/foo.i: size=64
   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
+  zstd/.hg/store/data/foo.i: size=64 (zstd !)
 
 Test error cases
 
@@ -144,6 +148,41 @@
   abort: invalid value for `storage.revlog.zlib.level` config: 42
   [255]
 
+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
+  
+
+  $ cat none-compression/.hg/requires
+  dotencode
+  exp-compression-none
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+  testonly-simplestore (reposimplestore !)
+
+  $ $RUNTESTDIR/f -s none-compression/.hg/store/data/*
+  none-compression/.hg/store/data/a.i: size=4216
+
 #if zstd
 
 checking zstd options