comparison mercurial/upgrade.py @ 48779:17eaeb06562c

upgrade: prepare code (and output) for the idea of upgrading share This would work for a subset of action only. Our first target is dirstate-v2. Differential Revision: https://phab.mercurial-scm.org/D12196
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 15 Feb 2022 23:09:07 +0100
parents a4d8de93023c
children 6000f5b25c9b
comparison
equal deleted inserted replaced
48778:c4149a110b5f 48779:17eaeb06562c
105 else: 105 else:
106 touched_revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS) 106 touched_revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS)
107 for rl, enabled in specified_revlogs.items(): 107 for rl, enabled in specified_revlogs.items():
108 if not enabled: 108 if not enabled:
109 touched_revlogs.discard(rl) 109 touched_revlogs.discard(rl)
110
111 if repo.shared():
112 unsafe_actions = set()
113 unsafe_actions.update(up_actions)
114 unsafe_actions.update(removed_actions)
115 unsafe_actions.update(optimizations)
116 unsafe_actions = [
117 a for a in unsafe_actions if not a.compatible_with_share
118 ]
119 unsafe_actions.sort(key=lambda a: a.name)
120 if unsafe_actions:
121 m = _(b'cannot use these actions on a share repository: %s')
122 h = _(b'upgrade the main repository directly')
123 actions = b', '.join(a.name for a in unsafe_actions)
124 m %= actions
125 raise error.Abort(m, hint=h)
110 126
111 for action in sorted(up_actions + removed_actions, key=lambda a: a.name): 127 for action in sorted(up_actions + removed_actions, key=lambda a: a.name):
112 # optimisation does not "requires anything, they just needs it. 128 # optimisation does not "requires anything, they just needs it.
113 if action.type != upgrade_actions.FORMAT_VARIANT: 129 if action.type != upgrade_actions.FORMAT_VARIANT:
114 continue 130 continue