Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade_utils/actions.py @ 46851:3aa78f2aea48
revlog-compression: fix computation of engine availability
We don't just need the engine to be define, we need it to be available and able
to do be used for revlog compression. Without this change, `zstd` could be
selected as a viable option for repository creation on platform where it is not
available.
Differential Revision: https://phab.mercurial-scm.org/D10325
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 07 Apr 2021 12:15:28 +0200 |
parents | 7d9d9265d40f |
children | 84a93fa7ecfd |
comparison
equal
deleted
inserted
replaced
46850:9dfcadc2cabb | 46851:3aa78f2aea48 |
---|---|
426 def fromconfig(cls, repo): | 426 def fromconfig(cls, repo): |
427 compengines = repo.ui.configlist(b'format', b'revlog-compression') | 427 compengines = repo.ui.configlist(b'format', b'revlog-compression') |
428 # return the first valid value as the selection code would do | 428 # return the first valid value as the selection code would do |
429 for comp in compengines: | 429 for comp in compengines: |
430 if comp in util.compengines: | 430 if comp in util.compengines: |
431 return comp | 431 e = util.compengines[comp] |
432 if e.available() and e.revlogheader(): | |
433 return comp | |
432 | 434 |
433 # no valide compression found lets display it all for clarity | 435 # no valide compression found lets display it all for clarity |
434 return b','.join(compengines) | 436 return b','.join(compengines) |
435 | 437 |
436 | 438 |