util: expose an "available" API on compression engines
When the zstd compression engine is introduced, it won't work in all
installations, namely pure Python installs. So, we need a mechanism to
declare whether a compression engine is available. We don't want to
conditionally register the compression engine because it is sometimes
useful to know when a compression engine name or encountered data is
valid but just not available versus unknown.
--- a/mercurial/util.py Thu Nov 10 22:26:35 2016 -0800
+++ b/mercurial/util.py Thu Nov 10 23:03:48 2016 -0800
@@ -3047,6 +3047,15 @@
"""
raise NotImplementedError()
+ def available(self):
+ """Whether the compression engine is available.
+
+ The intent of this method is to allow optional compression engines
+ that may not be available in all installations (such as engines relying
+ on C extensions that may not be present).
+ """
+ return True
+
def bundletype(self):
"""Describes bundle identifiers for this engine.