comparison mercurial/upgrade.py @ 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 0181f99819d2
children 75520786ad2f
comparison
equal deleted inserted replaced
35339:740d40ec15c3 35340:ead01b74be04
281 return all(rev == chainbase(rev) for rev in cl) 281 return all(rev == chainbase(rev) for rev in cl)
282 282
283 @staticmethod 283 @staticmethod
284 def fromconfig(repo): 284 def fromconfig(repo):
285 return True 285 return True
286
287 @registerformatvariant
288 class compressionengine(formatvariant):
289 name = 'compression'
290 default = 'zlib'
291
292 description = _('Compresion algorithm used to compress data. '
293 'Some engine are faster than other')
294
295 upgrademessage = _('revlog content will be recompressed with the new '
296 'algorithm.')
297
298 @classmethod
299 def fromrepo(cls, repo):
300 for req in repo.requirements:
301 if req.startswith('exp-compression-'):
302 return req.split('-', 2)[2]
303 return 'zlib'
304
305 @classmethod
306 def fromconfig(cls, repo):
307 return repo.ui.config('experimental', 'format.compression')
286 308
287 def finddeficiencies(repo): 309 def finddeficiencies(repo):
288 """returns a list of deficiencies that the repo suffer from""" 310 """returns a list of deficiencies that the repo suffer from"""
289 deficiencies = [] 311 deficiencies = []
290 312