Mercurial > public > mercurial-scm > hg-stable
diff mercurial/upgrade.py @ 35349:ead01b74be04
upgrade: register compression as a format variants
Compression is a promising vector for speedup, let us make it easier to check
the compression used and upgrade existing repository.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 07 Dec 2017 16:50:48 +0100 |
parents | 0181f99819d2 |
children | 75520786ad2f |
line wrap: on
line diff
--- a/mercurial/upgrade.py Thu Dec 07 16:49:24 2017 +0100 +++ b/mercurial/upgrade.py Thu Dec 07 16:50:48 2017 +0100 @@ -284,6 +284,28 @@ def fromconfig(repo): return True +@registerformatvariant +class compressionengine(formatvariant): + name = 'compression' + default = 'zlib' + + description = _('Compresion algorithm used to compress data. ' + 'Some engine are faster than other') + + upgrademessage = _('revlog content will be recompressed with the new ' + 'algorithm.') + + @classmethod + def fromrepo(cls, repo): + for req in repo.requirements: + if req.startswith('exp-compression-'): + return req.split('-', 2)[2] + return 'zlib' + + @classmethod + def fromconfig(cls, repo): + return repo.ui.config('experimental', 'format.compression') + def finddeficiencies(repo): """returns a list of deficiencies that the repo suffer from""" deficiencies = []