mercurial/upgrade_utils/auto_upgrade.py
changeset 49341 b38f5063a0c6
parent 49340 1b9114709428
child 49342 67b210bb5ce2
equal deleted inserted replaced
49340:1b9114709428 49341: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')