revert: add a way for external extensions to prefetch file data
authorPierre-Yves David <pierre-yves.david@fb.com>
Sat, 30 Aug 2014 02:47:59 +0200
changeset 22370 45e02cfad4bd
parent 22369 897041f6b025
child 22371 81ad62defef5
revert: add a way for external extensions to prefetch file data This allow extensions that mess with the storage layer (remotefilelog, largefile) to prefetch any data that will be accessed during the revert operation. We are currently fetching more data than theoretically required because the backup code is a bit stupid. Future patches will improve that.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sun Sep 07 11:46:11 2014 -0500
+++ b/mercurial/cmdutil.py	Sat Aug 30 02:47:59 2014 +0200
@@ -2527,6 +2527,9 @@
             (unknown,    actions['unknown'],  discard),
             )
 
+        needdata = ('revert', 'add', 'remove', 'undelete')
+        _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
+
         for abs, (rel, exact) in sorted(names.items()):
             # target file to be touch on disk (relative to cwd)
             target = repo.wjoin(abs)
@@ -2564,6 +2567,10 @@
     finally:
         wlock.release()
 
+def _revertprefetch(repo, ctx, *files):
+    """Let extension changing the storage layer prefetch content"""
+    pass
+
 def _performrevert(repo, parents, ctx, actions):
     """function that actually perform all the actions computed for revert