Show More
@@ -84,7 +84,7 b' def upgraderepo(' | |||||
84 | ) |
|
84 | ) | |
85 |
|
85 | |||
86 | format_upgrades = upgrade_actions.find_format_upgrades(repo) |
|
86 | format_upgrades = upgrade_actions.find_format_upgrades(repo) | |
87 | actions = upgrade_actions.determineactions( |
|
87 | up_actions = upgrade_actions.determine_upgrade_actions( | |
88 | repo, format_upgrades, optimizations, repo.requirements, newreqs |
|
88 | repo, format_upgrades, optimizations, repo.requirements, newreqs | |
89 | ) |
|
89 | ) | |
90 |
|
90 | |||
@@ -107,7 +107,7 b' def upgraderepo(' | |||||
107 | ui, |
|
107 | ui, | |
108 | newreqs, |
|
108 | newreqs, | |
109 | repo.requirements, |
|
109 | repo.requirements, | |
110 | actions, |
|
110 | up_actions, | |
111 | revlogs, |
|
111 | revlogs, | |
112 | ) |
|
112 | ) | |
113 |
|
113 |
@@ -526,7 +526,7 b' def findoptimizations(repo):' | |||||
526 | return list(ALL_OPTIMISATIONS) |
|
526 | return list(ALL_OPTIMISATIONS) | |
527 |
|
527 | |||
528 |
|
528 | |||
529 | def determineactions( |
|
529 | def determine_upgrade_actions( | |
530 | repo, format_upgrades, optimizations, sourcereqs, destreqs |
|
530 | repo, format_upgrades, optimizations, sourcereqs, destreqs | |
531 | ): |
|
531 | ): | |
532 | """Determine upgrade actions that will be performed. |
|
532 | """Determine upgrade actions that will be performed. | |
@@ -569,14 +569,15 b' class UpgradeOperation(object):' | |||||
569 | ui, |
|
569 | ui, | |
570 | new_requirements, |
|
570 | new_requirements, | |
571 | current_requirements, |
|
571 | current_requirements, | |
572 | actions, |
|
572 | upgrade_actions, | |
573 | revlogs_to_process, |
|
573 | revlogs_to_process, | |
574 | ): |
|
574 | ): | |
575 | self.ui = ui |
|
575 | self.ui = ui | |
576 | self.new_requirements = new_requirements |
|
576 | self.new_requirements = new_requirements | |
577 | self.current_requirements = current_requirements |
|
577 | self.current_requirements = current_requirements | |
578 | self.actions = actions |
|
578 | # list of upgrade actions the operation will perform | |
579 |
self._actions |
|
579 | self.upgrade_actions = upgrade_actions | |
|
580 | self._upgrade_actions_names = set([a.name for a in upgrade_actions]) | |||
580 | self.revlogs_to_process = revlogs_to_process |
|
581 | self.revlogs_to_process = revlogs_to_process | |
581 | # requirements which will be added by the operation |
|
582 | # requirements which will be added by the operation | |
582 | self._added_requirements = ( |
|
583 | self._added_requirements = ( | |
@@ -594,7 +595,7 b' class UpgradeOperation(object):' | |||||
594 | # should use them |
|
595 | # should use them | |
595 | all_optimizations = findoptimizations(None) |
|
596 | all_optimizations = findoptimizations(None) | |
596 | self.unused_optimizations = [ |
|
597 | self.unused_optimizations = [ | |
597 | i for i in all_optimizations if i not in self.actions |
|
598 | i for i in all_optimizations if i not in self.upgrade_actions | |
598 | ] |
|
599 | ] | |
599 |
|
600 | |||
600 | def _write_labeled(self, l, label): |
|
601 | def _write_labeled(self, l, label): | |
@@ -630,7 +631,9 b' class UpgradeOperation(object):' | |||||
630 | self.ui.write(b'\n') |
|
631 | self.ui.write(b'\n') | |
631 |
|
632 | |||
632 | def print_optimisations(self): |
|
633 | def print_optimisations(self): | |
633 | optimisations = [a for a in self.actions if a.type == OPTIMISATION] |
|
634 | optimisations = [ | |
|
635 | a for a in self.upgrade_actions if a.type == OPTIMISATION | |||
|
636 | ] | |||
634 | optimisations.sort(key=lambda a: a.name) |
|
637 | optimisations.sort(key=lambda a: a.name) | |
635 | if optimisations: |
|
638 | if optimisations: | |
636 | self.ui.write(_(b'optimisations: ')) |
|
639 | self.ui.write(_(b'optimisations: ')) | |
@@ -641,7 +644,7 b' class UpgradeOperation(object):' | |||||
641 | self.ui.write(b'\n\n') |
|
644 | self.ui.write(b'\n\n') | |
642 |
|
645 | |||
643 | def print_upgrade_actions(self): |
|
646 | def print_upgrade_actions(self): | |
644 | for a in self.actions: |
|
647 | for a in self.upgrade_actions: | |
645 | self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) |
|
648 | self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) | |
646 |
|
649 | |||
647 | def print_affected_revlogs(self): |
|
650 | def print_affected_revlogs(self): | |
@@ -657,9 +660,9 b' class UpgradeOperation(object):' | |||||
657 | for i in self.unused_optimizations: |
|
660 | for i in self.unused_optimizations: | |
658 | self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description)) |
|
661 | self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description)) | |
659 |
|
662 | |||
660 | def has_action(self, name): |
|
663 | def has_upgrade_action(self, name): | |
661 | """ Check whether the upgrade operation will perform this action """ |
|
664 | """ Check whether the upgrade operation will perform this action """ | |
662 | return name in self._actions_names |
|
665 | return name in self._upgrade_actions_names | |
663 |
|
666 | |||
664 |
|
667 | |||
665 | ### Code checking if a repository can got through the upgrade process at all. # |
|
668 | ### Code checking if a repository can got through the upgrade process at all. # |
@@ -451,13 +451,13 b' def upgrade(ui, srcrepo, dstrepo, upgrad' | |||||
451 | ) |
|
451 | ) | |
452 | ) |
|
452 | ) | |
453 |
|
453 | |||
454 | if upgrade_op.has_action(b're-delta-all'): |
|
454 | if upgrade_op.has_upgrade_action(b're-delta-all'): | |
455 | deltareuse = revlog.revlog.DELTAREUSENEVER |
|
455 | deltareuse = revlog.revlog.DELTAREUSENEVER | |
456 | elif upgrade_op.has_action(b're-delta-parent'): |
|
456 | elif upgrade_op.has_upgrade_action(b're-delta-parent'): | |
457 | deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
|
457 | deltareuse = revlog.revlog.DELTAREUSESAMEREVS | |
458 | elif upgrade_op.has_action(b're-delta-multibase'): |
|
458 | elif upgrade_op.has_upgrade_action(b're-delta-multibase'): | |
459 | deltareuse = revlog.revlog.DELTAREUSESAMEREVS |
|
459 | deltareuse = revlog.revlog.DELTAREUSESAMEREVS | |
460 | elif upgrade_op.has_action(b're-delta-fulladd'): |
|
460 | elif upgrade_op.has_upgrade_action(b're-delta-fulladd'): | |
461 | deltareuse = revlog.revlog.DELTAREUSEFULLADD |
|
461 | deltareuse = revlog.revlog.DELTAREUSEFULLADD | |
462 | else: |
|
462 | else: | |
463 | deltareuse = revlog.revlog.DELTAREUSEALWAYS |
|
463 | deltareuse = revlog.revlog.DELTAREUSEALWAYS | |
@@ -469,7 +469,7 b' def upgrade(ui, srcrepo, dstrepo, upgrad' | |||||
469 | dstrepo, |
|
469 | dstrepo, | |
470 | tr, |
|
470 | tr, | |
471 | deltareuse, |
|
471 | deltareuse, | |
472 | upgrade_op.has_action(b're-delta-multibase'), |
|
472 | upgrade_op.has_upgrade_action(b're-delta-multibase'), | |
473 | revlogs=upgrade_op.revlogs_to_process, |
|
473 | revlogs=upgrade_op.revlogs_to_process, | |
474 | ) |
|
474 | ) | |
475 |
|
475 |
General Comments 0
You need to be logged in to leave comments.
Login now