diff --git a/mercurial/configitems.py b/mercurial/configitems.py index a8ddcb15cce170c3d317f5d86b7f8ca3d4025aac_bWVyY3VyaWFsL2NvbmZpZ2l0ZW1zLnB5..b85f25577a37c03dfaa0c39509fa9d3556aeee5d_bWVyY3VyaWFsL2NvbmZpZ2l0ZW1zLnB5 100644 --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1307,7 +1307,7 @@ coreconfigitem( b'format', b'revlog-compression', - default=lambda: [b'zlib'], + default=lambda: [b'zstd', b'zlib'], alias=[(b'experimental', b'format.compression')], ) coreconfigitem( diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt index a8ddcb15cce170c3d317f5d86b7f8ca3d4025aac_bWVyY3VyaWFsL2hlbHB0ZXh0L2NvbmZpZy50eHQ=..b85f25577a37c03dfaa0c39509fa9d3556aeee5d_bWVyY3VyaWFsL2hlbHB0ZXh0L2NvbmZpZy50eHQ= 100644 --- a/mercurial/helptext/config.txt +++ b/mercurial/helptext/config.txt @@ -966,7 +966,7 @@ On some systems, the Mercurial installation may lack `zstd` support. - Default is `zlib`. + Default is `zstd` if available, `zlib` otherwise. ``bookmarks-in-store`` Store bookmarks in .hg/store/. This means that bookmarks are shared when diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py index a8ddcb15cce170c3d317f5d86b7f8ca3d4025aac_bWVyY3VyaWFsL3VwZ3JhZGVfdXRpbHMvYWN0aW9ucy5weQ==..b85f25577a37c03dfaa0c39509fa9d3556aeee5d_bWVyY3VyaWFsL3VwZ3JhZGVfdXRpbHMvYWN0aW9ucy5weQ== 100644 --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -395,6 +395,13 @@ return True +_has_zstd = ( + b'zstd' in util.compengines + and util.compengines[b'zstd'].available() + and util.compengines[b'zstd'].revlogheader() +) + + @registerformatvariant class compressionengine(formatvariant): name = b'compression' @@ -398,7 +405,11 @@ @registerformatvariant class compressionengine(formatvariant): name = b'compression' - default = b'zlib' + + if _has_zstd: + default = b'zstd' + else: + default = b'zlib' description = _( b'Compresion algorithm used to compress data. '