comparison mercurial/commands.py @ 42144:013de80bf90e

recover: add a --[no-]verify flag For trivial cases, the cost of the verify run after `hg recover` is getting in the way. In addition for very large repositories, the cost is simply too high to be paid, making `hg recover` an unusable commands. We introduce a --verify flag, set by default. If is automatically associated with a --no-verify flag that one can use to skip the verify step. We might consider changing the default behavior in the future. However this is out of scope for this series.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 17 Apr 2019 00:37:00 +0200
parents a362b0b95e42
children 496ac8a02380 50eacdeea88c
comparison
equal deleted inserted replaced
42143:29569f2db929 42144:013de80bf90e
4653 elif not result and pushop.bkresult: 4653 elif not result and pushop.bkresult:
4654 result = 2 4654 result = 2
4655 4655
4656 return result 4656 return result
4657 4657
4658 @command('recover', [], helpcategory=command.CATEGORY_MAINTENANCE) 4658 @command('recover',
4659 def recover(ui, repo): 4659 [('','verify', True, "run `hg verify` after succesful recover"),
4660 ],
4661 helpcategory=command.CATEGORY_MAINTENANCE)
4662 def recover(ui, repo, **opts):
4660 """roll back an interrupted transaction 4663 """roll back an interrupted transaction
4661 4664
4662 Recover from an interrupted commit or pull. 4665 Recover from an interrupted commit or pull.
4663 4666
4664 This command tries to fix the repository status after an 4667 This command tries to fix the repository status after an
4665 interrupted operation. It should only be necessary when Mercurial 4668 interrupted operation. It should only be necessary when Mercurial
4666 suggests it. 4669 suggests it.
4667 4670
4668 Returns 0 if successful, 1 if nothing to recover or verify fails. 4671 Returns 0 if successful, 1 if nothing to recover or verify fails.
4669 """ 4672 """
4670 if repo.recover(): 4673 ret = repo.recover()
4671 return hg.verify(repo) 4674 if ret:
4675 if opts['verify']:
4676 return hg.verify(repo)
4677 else:
4678 msg = _("(verify step skipped, run `hg verify` to check your "
4679 "repository content)\n")
4680 ui.warn(msg)
4681 return 0
4672 return 1 4682 return 1
4673 4683
4674 @command('remove|rm', 4684 @command('remove|rm',
4675 [('A', 'after', None, _('record delete for missing files')), 4685 [('A', 'after', None, _('record delete for missing files')),
4676 ('f', 'force', None, 4686 ('f', 'force', None,