Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/upgrade_utils/auto_upgrade.py @ 49345:b38f5063a0c6
auto-upgrade: add an option to silence the dirstate-v2 message
For well tested case, the message can get in the way, so we add a way to disable
it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 14 Jun 2022 15:19:45 +0200 |
parents | 1b9114709428 |
children | 67b210bb5ce2 |
comparison
equal
deleted
inserted
replaced
49344:1b9114709428 | 49345:b38f5063a0c6 |
---|---|
151 requirements = set(repo.requirements) | 151 requirements = set(repo.requirements) |
152 auto_upgrade_dv2 = ui.configbool( | 152 auto_upgrade_dv2 = ui.configbool( |
153 b'format', | 153 b'format', |
154 b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories', | 154 b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories', |
155 ) | 155 ) |
156 auto_upgrade_dv2_quiet = ui.configbool( | |
157 b'format', | |
158 b'use-dirstate-v2.automatic-upgrade-of-mismatching-repositories:quiet', | |
159 ) | |
156 | 160 |
157 action = None | 161 action = None |
158 | 162 |
159 if auto_upgrade_dv2: | 163 if auto_upgrade_dv2: |
160 d2_config = ui.configbool(b'format', b'use-dirstate-v2') | 164 d2_config = ui.configbool(b'format', b'use-dirstate-v2') |
167 hint = ( | 171 hint = ( |
168 b"(see `hg help config.format.use-dirstate-v2` for details)\n" | 172 b"(see `hg help config.format.use-dirstate-v2` for details)\n" |
169 ) | 173 ) |
170 | 174 |
171 def action(): | 175 def action(): |
172 if not ui.quiet: | 176 if not (ui.quiet or auto_upgrade_dv2_quiet): |
173 ui.write_err(msg) | 177 ui.write_err(msg) |
174 ui.write_err(hint) | 178 ui.write_err(hint) |
175 requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT) | 179 requirements.add(requirementsmod.DIRSTATE_V2_REQUIREMENT) |
176 fake_op = AutoUpgradeOperation(requirements) | 180 fake_op = AutoUpgradeOperation(requirements) |
177 engine.upgrade_dirstate(repo.ui, repo, fake_op, b'v1', b'v2') | 181 engine.upgrade_dirstate(repo.ui, repo, fake_op, b'v1', b'v2') |
184 hint = ( | 188 hint = ( |
185 b"(see `hg help config.format.use-dirstate-v2` for details)\n" | 189 b"(see `hg help config.format.use-dirstate-v2` for details)\n" |
186 ) | 190 ) |
187 | 191 |
188 def action(): | 192 def action(): |
189 if not ui.quiet: | 193 if not (ui.quiet or auto_upgrade_dv2_quiet): |
190 ui.write_err(msg) | 194 ui.write_err(msg) |
191 ui.write_err(hint) | 195 ui.write_err(hint) |
192 requirements.discard(requirementsmod.DIRSTATE_V2_REQUIREMENT) | 196 requirements.discard(requirementsmod.DIRSTATE_V2_REQUIREMENT) |
193 fake_op = AutoUpgradeOperation(requirements) | 197 fake_op = AutoUpgradeOperation(requirements) |
194 engine.upgrade_dirstate(repo.ui, repo, fake_op, b'v2', b'v1') | 198 engine.upgrade_dirstate(repo.ui, repo, fake_op, b'v2', b'v1') |