# HG changeset patch # User Pierre-Yves David <pierre-yves.da...@octobus.net> # Date 1555454220 -7200 # Wed Apr 17 00:37:00 2019 +0200 # Node ID f233cb63bc077267d8571378350d9563cbabcf3d # Parent eebf78724d94649de84f921ff5bd39cbc0f48cb6 # EXP-Topic verify # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f233cb63bc07 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. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4655,8 +4655,11 @@ def push(ui, repo, dest=None, **opts): 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 @@ def recover(ui, repo): 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', diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -332,7 +332,7 @@ Show all commands + options phase: public, draft, secret, force, rev pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure push: force, rev, bookmark, branch, new-branch, pushvars, publish, ssh, remotecmd, insecure - recover: + recover: verify remove: after, force, subrepos, include, exclude, dry-run rename: after, force, include, exclude, dry-run resolve: all, list, mark, unmark, no-status, re-merge, tool, include, exclude, template diff --git a/tests/test-journal-exists.t b/tests/test-journal-exists.t --- a/tests/test-journal-exists.t +++ b/tests/test-journal-exists.t @@ -21,6 +21,33 @@ checking files checked 1 changesets with 1 changes to 1 files +recover, explicite verify + + $ touch .hg/store/journal + $ hg ci -Am0 + abort: abandoned transaction found! + (run 'hg recover' to clean up transaction) + [255] + $ hg recover --verify + rolling back interrupted transaction + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + checked 1 changesets with 1 changes to 1 files + +recover, no verify + + $ touch .hg/store/journal + $ hg ci -Am0 + abort: abandoned transaction found! + (run 'hg recover' to clean up transaction) + [255] + $ hg recover --no-verify + rolling back interrupted transaction + (verify step skipped, run `hg verify` to check your repository content) + + Check that zero-size journals are correctly aborted: #if unix-permissions no-root _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel