comparison mercurial/upgrade.py @ 42832:a3c2ffcd266f

upgrade: make sure we reclone all revlogs when updating to some format Adding or removing some requirement (eg: sparserevlog), requires to reclone revlog to use the new format. We cannot simply copy the original files. In this case, we issue a warning to proceed with clone every revlogs.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Aug 2019 17:25:24 +0200
parents 908ff446590e
children bb6902cbbe23
comparison
equal deleted inserted replaced
42831:908ff446590e 42832:a3c2ffcd266f
25 ) 25 )
26 26
27 from .utils import ( 27 from .utils import (
28 compression, 28 compression,
29 ) 29 )
30
31 # list of requirements that request a clone of all revlog if added/removed
32 RECLONES_REQUIREMENTS = {
33 'generaldelta',
34 localrepo.SPARSEREVLOG_REQUIREMENT,
35 }
30 36
31 def requiredsourcerequirements(repo): 37 def requiredsourcerequirements(repo):
32 """Obtain requirements required to be present to upgrade a repo. 38 """Obtain requirements required to be present to upgrade a repo.
33 39
34 An upgrade will not be allowed if the repository doesn't have the 40 An upgrade will not be allowed if the repository doesn't have the
950 actions = determineactions(repo, deficiencies, repo.requirements, newreqs) 956 actions = determineactions(repo, deficiencies, repo.requirements, newreqs)
951 actions.extend(o for o in sorted(optimizations) 957 actions.extend(o for o in sorted(optimizations)
952 # determineactions could have added optimisation 958 # determineactions could have added optimisation
953 if o not in actions) 959 if o not in actions)
954 960
961 removedreqs = repo.requirements - newreqs
962 addedreqs = newreqs - repo.requirements
963
964 if revlogs != UPGRADE_ALL_REVLOGS:
965 incompatible = RECLONES_REQUIREMENTS & (removedreqs | addedreqs)
966 if incompatible:
967 msg = _('ignoring revlogs selection flags, format requirements '
968 'change: %s\n')
969 ui.warn(msg % ', '.join(sorted(incompatible)))
970 revlogs = UPGRADE_ALL_REVLOGS
971
955 def printrequirements(): 972 def printrequirements():
956 ui.write(_('requirements\n')) 973 ui.write(_('requirements\n'))
957 ui.write(_(' preserved: %s\n') % 974 ui.write(_(' preserved: %s\n') %
958 _(', ').join(sorted(newreqs & repo.requirements))) 975 _(', ').join(sorted(newreqs & repo.requirements)))
959 976