Mercurial > hg
changeset 35340: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 | 740d40ec15c3 |
children | cb7a0ae053c6 |
files | mercurial/upgrade.py tests/test-upgrade-repo.t |
diffstat | 2 files changed, 30 insertions(+), 0 deletions(-) [+] |
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 = []
--- a/tests/test-upgrade-repo.t Thu Dec 07 16:49:24 2017 +0100 +++ b/tests/test-upgrade-repo.t Thu Dec 07 16:50:48 2017 +0100 @@ -60,24 +60,28 @@ dotencode: yes generaldelta: yes plain-cl-delta: yes + compression: zlib $ hg debugformat --verbose format-variant repo config default fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes plain-cl-delta: yes yes yes + compression: zlib zlib zlib $ hg debugformat --verbose --config format.usegfncache=no format-variant repo config default fncache: yes yes yes dotencode: yes yes yes generaldelta: yes yes yes plain-cl-delta: yes yes yes + compression: zlib zlib zlib $ hg debugformat --verbose --config format.usegfncache=no --color=debug format-variant repo config default [formatvariant.name.uptodate|fncache: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|dotencode: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|generaldelta: ][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.uptodate|plain-cl-delta:][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] + [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] $ hg debugupgraderepo (no feature deficiencies found in existing repository) performing an upgrade with "--run" will make the following changes: @@ -131,24 +135,28 @@ dotencode: no generaldelta: no plain-cl-delta: yes + compression: zlib $ hg debugformat --verbose format-variant repo config default fncache: no yes yes dotencode: no yes yes generaldelta: no yes yes plain-cl-delta: yes yes yes + compression: zlib zlib zlib $ hg debugformat --verbose --config format.usegeneraldelta=no format-variant repo config default fncache: no yes yes dotencode: no yes yes generaldelta: no no yes plain-cl-delta: yes yes yes + compression: zlib zlib zlib $ hg debugformat --verbose --config format.usegeneraldelta=no --color=debug format-variant repo config default [formatvariant.name.mismatchconfig|fncache: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.mismatchconfig|dotencode: ][formatvariant.repo.mismatchconfig| no][formatvariant.config.default| yes][formatvariant.default| yes] [formatvariant.name.mismatchdefault|generaldelta: ][formatvariant.repo.mismatchdefault| no][formatvariant.config.special| no][formatvariant.default| yes] [formatvariant.name.uptodate|plain-cl-delta:][formatvariant.repo.uptodate| yes][formatvariant.config.default| yes][formatvariant.default| yes] + [formatvariant.name.uptodate|compression: ][formatvariant.repo.uptodate| zlib][formatvariant.config.default| zlib][formatvariant.default| zlib] $ hg debugupgraderepo repository lacks features recommended by current config options: