diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2765,9 +2765,6 @@ def revert(ui, repo, ctx, parents, *pats (unknown, actions['unknown'], discard), ) - needdata = ('revert', 'add', 'undelete') - _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) - wctx = repo[None] for abs, (rel, exact) in sorted(names.items()): # target file to be touch on disk (relative to cwd) @@ -2797,6 +2794,9 @@ def revert(ui, repo, ctx, parents, *pats if not opts.get('dry_run'): + needdata = ('revert', 'add', 'undelete') + _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) + _performrevert(repo, parents, ctx, actions) # get the list of subrepos that must be reverted