Mercurial > hg
comparison mercurial/upgrade.py @ 48448:62e6222cc5b6
upgrade: only process revlogs that needs it by default
We have more and more requirement that does not affect revlog or that only
affect some of them. It is silly to force a full processing of all revlog to
juste move the requirement around, or to simply rewrite the dirstate.
So now, only the revlog that needs to be touched will be touched. Unless the
--changelog & al flags are used.
Differential Revision: https://phab.mercurial-scm.org/D11871
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 06 Dec 2021 17:54:39 +0100 |
parents | 8405c1bffacf |
children | dc2ef4b4d9a9 |
comparison
equal
deleted
inserted
replaced
48447:8405c1bffacf | 48448:62e6222cc5b6 |
---|---|
96 msg_issued = 0 | 96 msg_issued = 0 |
97 | 97 |
98 FL = upgrade_engine.UPGRADE_FILELOGS | 98 FL = upgrade_engine.UPGRADE_FILELOGS |
99 MN = upgrade_engine.UPGRADE_MANIFEST | 99 MN = upgrade_engine.UPGRADE_MANIFEST |
100 CL = upgrade_engine.UPGRADE_CHANGELOG | 100 CL = upgrade_engine.UPGRADE_CHANGELOG |
101 | |
102 if optimizations: | |
103 if any(specified_revlogs.values()): | |
104 # we have some limitation on revlogs to be recloned | |
105 for rl, enabled in specified_revlogs.items(): | |
106 if enabled: | |
107 touched_revlogs.add(rl) | |
108 else: | |
109 touched_revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS) | |
110 for rl, enabled in specified_revlogs.items(): | |
111 if not enabled: | |
112 touched_revlogs.discard(rl) | |
101 | 113 |
102 for action in sorted(up_actions + removed_actions, key=lambda a: a.name): | 114 for action in sorted(up_actions + removed_actions, key=lambda a: a.name): |
103 # optimisation does not "requires anything, they just needs it. | 115 # optimisation does not "requires anything, they just needs it. |
104 if action.type != upgrade_actions.FORMAT_VARIANT: | 116 if action.type != upgrade_actions.FORMAT_VARIANT: |
105 continue | 117 continue |
145 if msg_issued >= 2: | 157 if msg_issued >= 2: |
146 ui.warn((b"\n")) | 158 ui.warn((b"\n")) |
147 elif msg_issued >= 1: | 159 elif msg_issued >= 1: |
148 ui.status((b"\n")) | 160 ui.status((b"\n")) |
149 | 161 |
150 revlogs = set(upgrade_engine.UPGRADE_ALL_REVLOGS) | |
151 if specified_revlogs: | |
152 # we have some limitation on revlogs to be recloned | |
153 if any(specified_revlogs.values()): | |
154 revlogs = set() | |
155 for upgrade, enabled in specified_revlogs.items(): | |
156 if enabled: | |
157 revlogs.add(upgrade) | |
158 else: | |
159 # none are enabled | |
160 for upgrade in specified_revlogs.keys(): | |
161 revlogs.discard(upgrade) | |
162 | |
163 # check the consistency of the revlog selection with the planned action | 162 # check the consistency of the revlog selection with the planned action |
164 | 163 |
165 if revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS: | 164 if touched_revlogs != upgrade_engine.UPGRADE_ALL_REVLOGS: |
166 incompatible = upgrade_actions.RECLONES_REQUIREMENTS & ( | 165 incompatible = upgrade_actions.RECLONES_REQUIREMENTS & ( |
167 removedreqs | addedreqs | 166 removedreqs | addedreqs |
168 ) | 167 ) |
169 if incompatible: | 168 if incompatible: |
170 msg = _( | 169 msg = _( |
171 b'ignoring revlogs selection flags, format requirements ' | 170 b'ignoring revlogs selection flags, format requirements ' |
172 b'change: %s\n' | 171 b'change: %s\n' |
173 ) | 172 ) |
174 ui.warn(msg % b', '.join(sorted(incompatible))) | 173 ui.warn(msg % b', '.join(sorted(incompatible))) |
175 revlogs = upgrade_engine.UPGRADE_ALL_REVLOGS | 174 touched_revlogs = upgrade_engine.UPGRADE_ALL_REVLOGS |
176 | 175 |
177 upgrade_op = upgrade_actions.UpgradeOperation( | 176 upgrade_op = upgrade_actions.UpgradeOperation( |
178 ui, | 177 ui, |
179 newreqs, | 178 newreqs, |
180 repo.requirements, | 179 repo.requirements, |
181 up_actions, | 180 up_actions, |
182 removed_actions, | 181 removed_actions, |
183 revlogs, | 182 touched_revlogs, |
184 backup, | 183 backup, |
185 ) | 184 ) |
186 | 185 |
187 if not run: | 186 if not run: |
188 fromconfig = [] | 187 fromconfig = [] |