Patchwork [2,of,6,V3] lfs: migrate to the fileprefetch callback mechanism

login
register
mail settings
Submitter Matt Harbison
Date Feb. 13, 2018, 5:39 a.m.
Message ID <f5461e496adbb52ed35e.1518500355@Envy>
Download mbox | patch
Permalink /patch/27805/
State Accepted
Headers show

Comments

Matt Harbison - Feb. 13, 2018, 5:39 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1518327015 18000
#      Sun Feb 11 00:30:15 2018 -0500
# Node ID f5461e496adbb52ed35e71e8a00c9f0b6b5b9c0f
# Parent  7d3abc6fcc2f39cd890c0062121dcb0ac44df45a
lfs: migrate to the fileprefetch callback mechanism

Patch

diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -334,7 +334,8 @@ 
     wrapfunction(hg, 'postshare', wrapper.hgpostshare)
 
     wrapfunction(merge, 'applyupdates', wrapper.mergemodapplyupdates)
-    wrapfunction(cmdutil, '_prefetchfiles', wrapper.cmdutilprefetchfiles)
+
+    scmutil.fileprefetchhooks.add('lfs', wrapper._prefetchfiles)
 
     # Make bundle choose changegroup3 instead of changegroup2. This affects
     # "hg bundle" command. Note: it does not cover all bundle formats like
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -266,12 +266,6 @@ 
     if pointers:
         repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore)
 
-def cmdutilprefetchfiles(orig, repo, ctx, files):
-    """Prefetch the indicated files before they are accessed by a command."""
-    orig(repo, ctx, files)
-
-    _prefetchfiles(repo, ctx, files)
-
 def mergemodapplyupdates(orig, repo, actions, wctx, mctx, overwrite,
                          labels=None):
     """Ensure that the required LFS blobs are present before applying updates,