mercurial/upgrade_utils/actions.py
changeset 46874 84a93fa7ecfd
parent 46851 3aa78f2aea48
child 46903 856820b497fc
--- a/mercurial/upgrade_utils/actions.py	Wed Apr 07 13:31:15 2021 +0200
+++ b/mercurial/upgrade_utils/actions.py	Tue Apr 06 18:55:19 2021 +0200
@@ -395,10 +395,21 @@
         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'
-    default = b'zlib'
+
+    if _has_zstd:
+        default = b'zstd'
+    else:
+        default = b'zlib'
 
     description = _(
         b'Compresion algorithm used to compress data. '