comparison mercurial/upgrade.py @ 46009:cfae98c4e1f1

upgrade: capitalize the `deficiency` constant I am reworking this code and moving to the current naming scheme help readability. Differential Revision: https://phab.mercurial-scm.org/D9474
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 30 Nov 2020 23:54:25 +0100
parents 8037d0641146
children 32dcd783a985
comparison
equal deleted inserted replaced
46008:8037d0641146 46009:cfae98c4e1f1
150 def preservedrequirements(repo): 150 def preservedrequirements(repo):
151 return set() 151 return set()
152 152
153 153
154 DEFICIENCY = b'deficiency' 154 DEFICIENCY = b'deficiency'
155 optimisation = b'optimization' 155 OPTIMISATION = b'optimization'
156 156
157 157
158 class improvement(object): 158 class improvement(object):
159 """Represents an improvement that can be made as part of an upgrade. 159 """Represents an improvement that can be made as part of an upgrade.
160 160
163 name 163 name
164 Machine-readable string uniquely identifying this improvement. It 164 Machine-readable string uniquely identifying this improvement. It
165 will be mapped to an action later in the upgrade process. 165 will be mapped to an action later in the upgrade process.
166 166
167 type 167 type
168 Either ``DEFICIENCY`` or ``optimisation``. A deficiency is an obvious 168 Either ``DEFICIENCY`` or ``OPTIMISATION``. A deficiency is an obvious
169 problem. An optimization is an action (sometimes optional) that 169 problem. An optimization is an action (sometimes optional) that
170 can be taken to further improve the state of the repository. 170 can be taken to further improve the state of the repository.
171 171
172 description 172 description
173 Message intended for humans explaining the improvement in more detail, 173 Message intended for humans explaining the improvement in more detail,
174 including the implications of it. For ``DEFICIENCY`` types, should be 174 including the implications of it. For ``DEFICIENCY`` types, should be
175 worded in the present tense. For ``optimisation`` types, should be 175 worded in the present tense. For ``OPTIMISATION`` types, should be
176 worded in the future tense. 176 worded in the future tense.
177 177
178 upgrademessage 178 upgrademessage
179 Message intended for humans explaining what an upgrade addressing this 179 Message intended for humans explaining what an upgrade addressing this
180 issue will do. Should be worded in the future tense. 180 issue will do. Should be worded in the future tense.
549 optimizations = [] 549 optimizations = []
550 550
551 optimizations.append( 551 optimizations.append(
552 improvement( 552 improvement(
553 name=b're-delta-parent', 553 name=b're-delta-parent',
554 type=optimisation, 554 type=OPTIMISATION,
555 description=_( 555 description=_(
556 b'deltas within internal storage will be recalculated to ' 556 b'deltas within internal storage will be recalculated to '
557 b'choose an optimal base revision where this was not ' 557 b'choose an optimal base revision where this was not '
558 b'already done; the size of the repository may shrink and ' 558 b'already done; the size of the repository may shrink and '
559 b'various operations may become faster; the first time ' 559 b'various operations may become faster; the first time '
569 ) 569 )
570 570
571 optimizations.append( 571 optimizations.append(
572 improvement( 572 improvement(
573 name=b're-delta-multibase', 573 name=b're-delta-multibase',
574 type=optimisation, 574 type=OPTIMISATION,
575 description=_( 575 description=_(
576 b'deltas within internal storage will be recalculated ' 576 b'deltas within internal storage will be recalculated '
577 b'against multiple base revision and the smallest ' 577 b'against multiple base revision and the smallest '
578 b'difference will be used; the size of the repository may ' 578 b'difference will be used; the size of the repository may '
579 b'shrink significantly when there are many merges; this ' 579 b'shrink significantly when there are many merges; this '
593 ) 593 )
594 594
595 optimizations.append( 595 optimizations.append(
596 improvement( 596 improvement(
597 name=b're-delta-all', 597 name=b're-delta-all',
598 type=optimisation, 598 type=OPTIMISATION,
599 description=_( 599 description=_(
600 b'deltas within internal storage will always be ' 600 b'deltas within internal storage will always be '
601 b'recalculated without reusing prior deltas; this will ' 601 b'recalculated without reusing prior deltas; this will '
602 b'likely make execution run several times slower; this ' 602 b'likely make execution run several times slower; this '
603 b'optimization is typically not needed' 603 b'optimization is typically not needed'
611 ) 611 )
612 612
613 optimizations.append( 613 optimizations.append(
614 improvement( 614 improvement(
615 name=b're-delta-fulladd', 615 name=b're-delta-fulladd',
616 type=optimisation, 616 type=OPTIMISATION,
617 description=_( 617 description=_(
618 b'every revision will be re-added as if it was new ' 618 b'every revision will be re-added as if it was new '
619 b'content. It will go through the full storage ' 619 b'content. It will go through the full storage '
620 b'mechanism giving extensions a chance to process it ' 620 b'mechanism giving extensions a chance to process it '
621 b'(eg. lfs). This is similar to "re-delta-all" but even ' 621 b'(eg. lfs). This is similar to "re-delta-all" but even '
1293 write_labeled(added, "upgrade-repo.requirement.added") 1293 write_labeled(added, "upgrade-repo.requirement.added")
1294 ui.write((b'\n')) 1294 ui.write((b'\n'))
1295 ui.write(b'\n') 1295 ui.write(b'\n')
1296 1296
1297 def printoptimisations(): 1297 def printoptimisations():
1298 optimisations = [a for a in actions if a.type == optimisation] 1298 optimisations = [a for a in actions if a.type == OPTIMISATION]
1299 optimisations.sort(key=lambda a: a.name) 1299 optimisations.sort(key=lambda a: a.name)
1300 if optimisations: 1300 if optimisations:
1301 ui.write(_(b'optimisations: ')) 1301 ui.write(_(b'optimisations: '))
1302 write_labeled( 1302 write_labeled(
1303 [a.name for a in optimisations], 1303 [a.name for a in optimisations],