##// END OF EJS Templates
cmdutil: convert _revertprefetch() to a generic stored file hook (API)...
Matt Harbison -
r35941:efbd0423 default
parent child Browse files
Show More
@@ -2862,7 +2862,14 b' def revert(ui, repo, ctx, parents, *pats'
2862
2862
2863 if not opts.get('dry_run'):
2863 if not opts.get('dry_run'):
2864 needdata = ('revert', 'add', 'undelete')
2864 needdata = ('revert', 'add', 'undelete')
2865 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
2865 if _revertprefetch is not _revertprefetchstub:
2866 ui.deprecwarn("'cmdutil._revertprefetch' is deprecated, use "
2867 "'cmdutil._prefetchfiles'", '4.6', stacklevel=1)
2868 _revertprefetch(repo, ctx,
2869 *[actions[name][0] for name in needdata])
2870 oplist = [actions[name][0] for name in needdata]
2871 _prefetchfiles(repo, ctx,
2872 [f for sublist in oplist for f in sublist])
2866 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
2873 _performrevert(repo, parents, ctx, actions, interactive, tobackup)
2867
2874
2868 if targetsubs:
2875 if targetsubs:
@@ -2875,8 +2882,15 b' def revert(ui, repo, ctx, parents, *pats'
2875 raise error.Abort("subrepository '%s' does not exist in %s!"
2882 raise error.Abort("subrepository '%s' does not exist in %s!"
2876 % (sub, short(ctx.node())))
2883 % (sub, short(ctx.node())))
2877
2884
2878 def _revertprefetch(repo, ctx, *files):
2885 def _revertprefetchstub(repo, ctx, *files):
2879 """Let extension changing the storage layer prefetch content"""
2886 """Stub method for detecting extension wrapping of _revertprefetch(), to
2887 issue a deprecation warning."""
2888
2889 _revertprefetch = _revertprefetchstub
2890
2891 def _prefetchfiles(repo, ctx, files):
2892 """Let extensions changing the storage layer prefetch content for any non
2893 merge based command."""
2880
2894
2881 def _performrevert(repo, parents, ctx, actions, interactive=False,
2895 def _performrevert(repo, parents, ctx, actions, interactive=False,
2882 tobackup=None):
2896 tobackup=None):
@@ -1614,7 +1614,7 b' class ui(object):'
1614 msg, *calframe[stacklevel][1:4])
1614 msg, *calframe[stacklevel][1:4])
1615 curframe = calframe = None # avoid cycles
1615 curframe = calframe = None # avoid cycles
1616
1616
1617 def deprecwarn(self, msg, version):
1617 def deprecwarn(self, msg, version, stacklevel=2):
1618 """issue a deprecation warning
1618 """issue a deprecation warning
1619
1619
1620 - msg: message explaining what is deprecated and how to upgrade,
1620 - msg: message explaining what is deprecated and how to upgrade,
@@ -1625,7 +1625,7 b' class ui(object):'
1625 return
1625 return
1626 msg += ("\n(compatibility will be dropped after Mercurial-%s,"
1626 msg += ("\n(compatibility will be dropped after Mercurial-%s,"
1627 " update your code.)") % version
1627 " update your code.)") % version
1628 self.develwarn(msg, stacklevel=2, config='deprec-warn')
1628 self.develwarn(msg, stacklevel=stacklevel, config='deprec-warn')
1629
1629
1630 def exportableenviron(self):
1630 def exportableenviron(self):
1631 """The environment variables that are safe to export, e.g. through
1631 """The environment variables that are safe to export, e.g. through
General Comments 0
You need to be logged in to leave comments. Login now