diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2862,7 +2862,14 @@ 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]) + if _revertprefetch is not _revertprefetchstub: + ui.deprecwarn("'cmdutil._revertprefetch' is deprecated, use " + "'cmdutil._prefetchfiles'", '4.6', stacklevel=1) + _revertprefetch(repo, ctx, + *[actions[name][0] for name in needdata]) + oplist = [actions[name][0] for name in needdata] + _prefetchfiles(repo, ctx, + [f for sublist in oplist for f in sublist]) _performrevert(repo, parents, ctx, actions, interactive, tobackup) if targetsubs: @@ -2875,8 +2882,15 @@ def revert(ui, repo, ctx, parents, *pats raise error.Abort("subrepository '%s' does not exist in %s!" % (sub, short(ctx.node()))) -def _revertprefetch(repo, ctx, *files): - """Let extension changing the storage layer prefetch content""" +def _revertprefetchstub(repo, ctx, *files): + """Stub method for detecting extension wrapping of _revertprefetch(), to + issue a deprecation warning.""" + +_revertprefetch = _revertprefetchstub + +def _prefetchfiles(repo, ctx, files): + """Let extensions changing the storage layer prefetch content for any non + merge based command.""" def _performrevert(repo, parents, ctx, actions, interactive=False, tobackup=None): diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1614,7 +1614,7 @@ class ui(object): msg, *calframe[stacklevel][1:4]) curframe = calframe = None # avoid cycles - def deprecwarn(self, msg, version): + def deprecwarn(self, msg, version, stacklevel=2): """issue a deprecation warning - msg: message explaining what is deprecated and how to upgrade, @@ -1625,7 +1625,7 @@ class ui(object): return msg += ("\n(compatibility will be dropped after Mercurial-%s," " update your code.)") % version - self.develwarn(msg, stacklevel=2, config='deprec-warn') + self.develwarn(msg, stacklevel=stacklevel, config='deprec-warn') def exportableenviron(self): """The environment variables that are safe to export, e.g. through