Mercurial > hg
comparison mercurial/upgrade.py @ 42136:10a6725dca6e
compression: introduce an official `zstd-revlog` requirement
This requirement supersedes `exp-compression-zstd`. However, we keep support for
the old requirement.
Strictly speaking, we do not need to add a new requirement, there are no logic
change making "new" repo incompatible with mercurial client using a version
that support `exp-compression-zstd`.
The choice to introduce a new requirement is motivated by the following:
* The previous requirement was explicitly "experimental". Using it by default
could confuse users.
* adding support for a hypothetical third compression engine will requires new
code, and will comes with its own requirement tool.
* We won't use it as the default for a while since I do not think we support
zstd on all platform. I can imagine we'll gain another (unrelated but on my
default) requirement by the time we turn this zstd by default.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 27 Mar 2019 18:27:03 +0100 |
parents | 4ee906aa7b60 |
children | d086ba387ae8 |
comparison
equal
deleted
inserted
replaced
42135:b970fece153d | 42136:10a6725dca6e |
---|---|
323 upgrademessage = _('revlog content will be recompressed with the new ' | 323 upgrademessage = _('revlog content will be recompressed with the new ' |
324 'algorithm.') | 324 'algorithm.') |
325 | 325 |
326 @classmethod | 326 @classmethod |
327 def fromrepo(cls, repo): | 327 def fromrepo(cls, repo): |
328 # we allow multiple compression engine requirement to co-exist because | |
329 # strickly speaking, revlog seems to support mixed compression style. | |
330 # | |
331 # The compression used for new entries will be "the last one" | |
332 compression = 'zlib' | |
328 for req in repo.requirements: | 333 for req in repo.requirements: |
329 if req.startswith('exp-compression-'): | 334 prefix = req.startswith |
330 return req.split('-', 2)[2] | 335 if prefix('revlog-compression-') or prefix('exp-compression-'): |
331 return 'zlib' | 336 compression = req.split('-', 2)[2] |
337 return compression | |
332 | 338 |
333 @classmethod | 339 @classmethod |
334 def fromconfig(cls, repo): | 340 def fromconfig(cls, repo): |
335 return repo.ui.config('format', 'revlog-compression') | 341 return repo.ui.config('format', 'revlog-compression') |
336 | 342 |