Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade.py @ 46190:9ab2ab5bf9af
upgrade: move `printoptimisations() to UpgradeOperation class
Part of refactor where we make things more arranged and integrated into single
`UpgradeOperation` class.
Differential Revision: https://phab.mercurial-scm.org/D9576
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 12 Dec 2020 18:00:18 +0530 |
parents | dfddcbb0c244 |
children | aba979b1b90b |
comparison
equal
deleted
inserted
replaced
46189:dfddcbb0c244 | 46190:9ab2ab5bf9af |
---|---|
148 ui.write(_(b' added: ')) | 148 ui.write(_(b' added: ')) |
149 write_labeled(added, "upgrade-repo.requirement.added") | 149 write_labeled(added, "upgrade-repo.requirement.added") |
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, |
169 actions, | 156 actions, |
170 revlogs, | 157 revlogs, |
217 b'changes:\n\n' | 204 b'changes:\n\n' |
218 ) | 205 ) |
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 |
226 unusedoptimize = [i for i in alloptimizations if i not in actions] | 213 unusedoptimize = [i for i in alloptimizations if i not in actions] |
227 | 214 |
237 return | 224 return |
238 | 225 |
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 |
246 ui.status(_(b'beginning upgrade...\n')) | 233 ui.status(_(b'beginning upgrade...\n')) |
247 with repo.wlock(), repo.lock(): | 234 with repo.wlock(), repo.lock(): |