Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 42147: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 | 50eacdeea88c 496ac8a02380 |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Apr 02 19:48:31 2019 +0200 +++ b/mercurial/commands.py Wed Apr 17 00:37:00 2019 +0200 @@ -4655,8 +4655,11 @@ return result -@command('recover', [], helpcategory=command.CATEGORY_MAINTENANCE) -def recover(ui, repo): +@command('recover', + [('','verify', True, "run `hg verify` after succesful recover"), + ], + helpcategory=command.CATEGORY_MAINTENANCE) +def recover(ui, repo, **opts): """roll back an interrupted transaction Recover from an interrupted commit or pull. @@ -4667,8 +4670,15 @@ Returns 0 if successful, 1 if nothing to recover or verify fails. """ - if repo.recover(): - return hg.verify(repo) + ret = repo.recover() + if ret: + if opts['verify']: + return hg.verify(repo) + else: + msg = _("(verify step skipped, run `hg verify` to check your " + "repository content)\n") + ui.warn(msg) + return 0 return 1 @command('remove|rm',