Show More
@@ -150,19 +150,6 b' def upgraderepo(' | |||||
150 | ui.write((b'\n')) |
|
150 | ui.write((b'\n')) | |
151 | ui.write(b'\n') |
|
151 | ui.write(b'\n') | |
152 |
|
152 | |||
153 | def printoptimisations(): |
|
|||
154 | optimisations = [ |
|
|||
155 | a for a in actions if a.type == upgrade_actions.OPTIMISATION |
|
|||
156 | ] |
|
|||
157 | optimisations.sort(key=lambda a: a.name) |
|
|||
158 | if optimisations: |
|
|||
159 | ui.write(_(b'optimisations: ')) |
|
|||
160 | write_labeled( |
|
|||
161 | [a.name for a in optimisations], |
|
|||
162 | "upgrade-repo.optimisation.performed", |
|
|||
163 | ) |
|
|||
164 | ui.write(b'\n\n') |
|
|||
165 |
|
||||
166 | upgrade_op = upgrade_actions.UpgradeOperation( |
|
153 | upgrade_op = upgrade_actions.UpgradeOperation( | |
167 | ui, |
|
154 | ui, | |
168 | newreqs, |
|
155 | newreqs, | |
@@ -219,7 +206,7 b' def upgraderepo(' | |||||
219 | ) |
|
206 | ) | |
220 |
|
207 | |||
221 | printrequirements() |
|
208 | printrequirements() | |
222 | printoptimisations() |
|
209 | upgrade_op.print_optimisations() | |
223 | upgrade_op.print_upgrade_actions() |
|
210 | upgrade_op.print_upgrade_actions() | |
224 | upgrade_op.print_affected_revlogs() |
|
211 | upgrade_op.print_affected_revlogs() | |
225 |
|
212 | |||
@@ -239,7 +226,7 b' def upgraderepo(' | |||||
239 | # Else we're in the run=true case. |
|
226 | # Else we're in the run=true case. | |
240 | ui.write(_(b'upgrade will perform the following actions:\n\n')) |
|
227 | ui.write(_(b'upgrade will perform the following actions:\n\n')) | |
241 | printrequirements() |
|
228 | printrequirements() | |
242 | printoptimisations() |
|
229 | upgrade_op.print_optimisations() | |
243 | upgrade_op.print_upgrade_actions() |
|
230 | upgrade_op.print_upgrade_actions() | |
244 | upgrade_op.print_affected_revlogs() |
|
231 | upgrade_op.print_affected_revlogs() | |
245 |
|
232 |
@@ -564,6 +564,28 b' class UpgradeOperation(object):' | |||||
564 | self._actions_names = set([a.name for a in actions]) |
|
564 | self._actions_names = set([a.name for a in actions]) | |
565 | self.revlogs_to_process = revlogs_to_process |
|
565 | self.revlogs_to_process = revlogs_to_process | |
566 |
|
566 | |||
|
567 | def _write_labeled(self, l, label): | |||
|
568 | """ | |||
|
569 | Utility function to aid writing of a list under one label | |||
|
570 | """ | |||
|
571 | first = True | |||
|
572 | for r in sorted(l): | |||
|
573 | if not first: | |||
|
574 | self.ui.write(b', ') | |||
|
575 | self.ui.write(r, label=label) | |||
|
576 | first = False | |||
|
577 | ||||
|
578 | def print_optimisations(self): | |||
|
579 | optimisations = [a for a in self.actions if a.type == OPTIMISATION] | |||
|
580 | optimisations.sort(key=lambda a: a.name) | |||
|
581 | if optimisations: | |||
|
582 | self.ui.write(_(b'optimisations: ')) | |||
|
583 | self._write_labeled( | |||
|
584 | [a.name for a in optimisations], | |||
|
585 | "upgrade-repo.optimisation.performed", | |||
|
586 | ) | |||
|
587 | self.ui.write(b'\n\n') | |||
|
588 | ||||
567 | def print_upgrade_actions(self): |
|
589 | def print_upgrade_actions(self): | |
568 | for a in self.actions: |
|
590 | for a in self.actions: | |
569 | self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) |
|
591 | self.ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) |
General Comments 0
You need to be logged in to leave comments.
Login now