comparison mercurial/upgrade.py @ 46213:30310886d423

upgrade: introduce post upgrade and downgrade message for improvements For certain imporvements, we will like to show a message after the operation completed. This patch introduces that functionality. Right now it's only used by share-safe feature. Differential Revision: https://phab.mercurial-scm.org/D9619
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 16 Dec 2020 14:00:41 +0530
parents 6b40aac4da8e
children 0ca98ed828f9
comparison
equal deleted inserted replaced
46212:c97d8e0406a6 46213:30310886d423
85 85
86 format_upgrades = upgrade_actions.find_format_upgrades(repo) 86 format_upgrades = upgrade_actions.find_format_upgrades(repo)
87 up_actions = upgrade_actions.determine_upgrade_actions( 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 removed_actions = upgrade_actions.find_format_downgrades(repo)
90 91
91 removedreqs = repo.requirements - newreqs 92 removedreqs = repo.requirements - newreqs
92 addedreqs = newreqs - repo.requirements 93 addedreqs = newreqs - repo.requirements
93 94
94 if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS: 95 if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS:
106 upgrade_op = upgrade_actions.UpgradeOperation( 107 upgrade_op = upgrade_actions.UpgradeOperation(
107 ui, 108 ui,
108 newreqs, 109 newreqs,
109 repo.requirements, 110 repo.requirements,
110 up_actions, 111 up_actions,
112 removed_actions,
111 revlogs, 113 revlogs,
112 ) 114 )
113 115
114 if not run: 116 if not run:
115 fromconfig = [] 117 fromconfig = []
224 b'it to free up disk space once the upgraded ' 226 b'it to free up disk space once the upgraded '
225 b'repository is verified\n' 227 b'repository is verified\n'
226 ) 228 )
227 ) 229 )
228 230
229 if upgrade_actions.sharesafe.name in addedreqs: 231 upgrade_op.print_post_op_messages()
230 ui.warn(
231 _(
232 b'repository upgraded to share safe mode, existing'
233 b' shares will still work in old non-safe mode. '
234 b'Re-share existing shares to use them in safe mode'
235 b' New shares will be created in safe mode.\n'
236 )
237 )
238 if upgrade_actions.sharesafe.name in removedreqs:
239 ui.warn(
240 _(
241 b'repository downgraded to not use share safe mode, '
242 b'existing shares will not work and needs to'
243 b' be reshared.\n'
244 )
245 )