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