# HG changeset patch # User Pierre-Yves David # Date 2021-04-07 10:15:28 # Node ID 3aa78f2aea4884371ee2d5f230692462f47e0d5e # Parent 9dfcadc2cabb30ead0b40cfbb9d692217ca1af7d revlog-compression: fix computation of engine availability We don't just need the engine to be define, we need it to be available and able to do be used for revlog compression. Without this change, `zstd` could be selected as a viable option for repository creation on platform where it is not available. Differential Revision: https://phab.mercurial-scm.org/D10325 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -3470,7 +3470,9 @@ def newreporequirements(ui, createopts): compengines = ui.configlist(b'format', b'revlog-compression') for compengine in compengines: if compengine in util.compengines: - break + engine = util.compengines[compengine] + if engine.available() and engine.revlogheader(): + break else: raise error.Abort( _( diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -428,7 +428,9 @@ class compressionengine(formatvariant): # return the first valid value as the selection code would do for comp in compengines: if comp in util.compengines: - return comp + e = util.compengines[comp] + if e.available() and e.revlogheader(): + return comp # no valide compression found lets display it all for clarity return b','.join(compengines)