mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
fe980ff373
Summary: Moves the remotefilelog extension into hgext/ and it's tests into tests/. I did not fix up all the check-module errors, since it's a ton of work for very little impact at this point. Test Plan: make local && ./run-tests.py Reviewers: #mercurial Differential Revision: https://phabricator.intern.facebook.com/D6680030
28 lines
886 B
Python
28 lines
886 B
Python
from __future__ import absolute_import
|
|
from mercurial import error
|
|
from mercurial.i18n import _
|
|
|
|
import lz4
|
|
|
|
def missing(*args, **kwargs):
|
|
raise error.Abort(_('remotefilelog extension requires lz4 support'))
|
|
|
|
lz4compress = lzcompresshc = lz4decompress = missing
|
|
|
|
try:
|
|
# newer python-lz4 has these functions deprecated as top-level ones,
|
|
# so we are trying to import from lz4.block first
|
|
def _compressHC(*args, **kwargs):
|
|
return lz4.block.compress(*args, mode='high_compression', **kwargs)
|
|
lzcompresshc = _compressHC
|
|
lz4compress = lz4.block.compress
|
|
lz4decompress = lz4.block.decompress
|
|
except (AttributeError, ImportError):
|
|
# ImportError is possible due to DemandImport
|
|
try:
|
|
lzcompresshc = lz4.compressHC
|
|
lz4compress = lz4.compress
|
|
lz4decompress = lz4.decompress
|
|
except (AttributeError, ImportError):
|
|
pass
|