Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 30437:64d7275445d0
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.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 10 Nov 2016 23:03:48 -0800 |
parents | 1156ec81f709 |
children | 90933e4e44fd |
comparison
equal
deleted
inserted
replaced
30436:788ea4ac4388 | 30437:64d7275445d0 |
---|---|
3045 | 3045 |
3046 This method must be implemented. | 3046 This method must be implemented. |
3047 """ | 3047 """ |
3048 raise NotImplementedError() | 3048 raise NotImplementedError() |
3049 | 3049 |
3050 def available(self): | |
3051 """Whether the compression engine is available. | |
3052 | |
3053 The intent of this method is to allow optional compression engines | |
3054 that may not be available in all installations (such as engines relying | |
3055 on C extensions that may not be present). | |
3056 """ | |
3057 return True | |
3058 | |
3050 def bundletype(self): | 3059 def bundletype(self): |
3051 """Describes bundle identifiers for this engine. | 3060 """Describes bundle identifiers for this engine. |
3052 | 3061 |
3053 If this compression engine isn't supported for bundles, returns None. | 3062 If this compression engine isn't supported for bundles, returns None. |
3054 | 3063 |