mercurial/scmutil.py
changeset 37762 7269b87f817c
parent 37709 7b2955624777
child 37767 44d1959acb3b
--- a/mercurial/scmutil.py	Mon Apr 16 23:39:30 2018 -0400
+++ b/mercurial/scmutil.py	Sat Apr 14 18:50:45 2018 -0400
@@ -1357,9 +1357,20 @@
     'unbundle',
 ]
 
-# a list of (repo, ctx, files) functions called by various commands to allow
-# extensions to ensure the corresponding files are available locally, before the
-# command uses them.
+def prefetchfiles(repo, revs, match):
+    """Invokes the registered file prefetch functions, allowing extensions to
+    ensure the corresponding files are available locally, before the command
+    uses them."""
+    if match:
+        # The command itself will complain about files that don't exist, so
+        # don't duplicate the message.
+        match = matchmod.badmatch(match, lambda fn, msg: None)
+    else:
+        match = matchall(repo)
+
+    fileprefetchhooks(repo, revs, match)
+
+# a list of (repo, revs, match) prefetch functions
 fileprefetchhooks = util.hooks()
 
 # A marker that tells the evolve extension to suppress its own reporting