Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade.py @ 46188:945b33a7edfd
upgrade: move `print_affected_revlogs()` 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/D9574
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 12 Dec 2020 17:51:27 +0530 |
parents | c407513a44a3 |
children | dfddcbb0c244 |
comparison
equal
deleted
inserted
replaced
46187:95d6f31e88db | 46188:945b33a7edfd |
---|---|
165 | 165 |
166 def printupgradeactions(): | 166 def printupgradeactions(): |
167 for a in actions: | 167 for a in actions: |
168 ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) | 168 ui.status(b'%s\n %s\n\n' % (a.name, a.upgrademessage)) |
169 | 169 |
170 def print_affected_revlogs(): | |
171 if not revlogs: | |
172 ui.write((b'no revlogs to process\n')) | |
173 else: | |
174 ui.write((b'processed revlogs:\n')) | |
175 for r in sorted(revlogs): | |
176 ui.write((b' - %s\n' % r)) | |
177 ui.write((b'\n')) | |
178 | |
179 upgrade_op = upgrade_actions.UpgradeOperation( | 170 upgrade_op = upgrade_actions.UpgradeOperation( |
171 ui, | |
180 newreqs, | 172 newreqs, |
181 [a.name for a in actions], | 173 [a.name for a in actions], |
182 revlogs, | 174 revlogs, |
183 ) | 175 ) |
184 | 176 |
231 ) | 223 ) |
232 | 224 |
233 printrequirements() | 225 printrequirements() |
234 printoptimisations() | 226 printoptimisations() |
235 printupgradeactions() | 227 printupgradeactions() |
236 print_affected_revlogs() | 228 upgrade_op.print_affected_revlogs() |
237 | 229 |
238 unusedoptimize = [i for i in alloptimizations if i not in actions] | 230 unusedoptimize = [i for i in alloptimizations if i not in actions] |
239 | 231 |
240 if unusedoptimize: | 232 if unusedoptimize: |
241 ui.status( | 233 ui.status( |
251 # Else we're in the run=true case. | 243 # Else we're in the run=true case. |
252 ui.write(_(b'upgrade will perform the following actions:\n\n')) | 244 ui.write(_(b'upgrade will perform the following actions:\n\n')) |
253 printrequirements() | 245 printrequirements() |
254 printoptimisations() | 246 printoptimisations() |
255 printupgradeactions() | 247 printupgradeactions() |
256 print_affected_revlogs() | 248 upgrade_op.print_affected_revlogs() |
257 | 249 |
258 ui.status(_(b'beginning upgrade...\n')) | 250 ui.status(_(b'beginning upgrade...\n')) |
259 with repo.wlock(), repo.lock(): | 251 with repo.wlock(), repo.lock(): |
260 ui.status(_(b'repository locked and read-only\n')) | 252 ui.status(_(b'repository locked and read-only\n')) |
261 # Our strategy for upgrading the repository is to create a new, | 253 # Our strategy for upgrading the repository is to create a new, |