changeset 35526:e8f80529abeb

lfs: use the local store method for opening a blob I noticed that when I cloned without updating and then turned around and pushed that clone to an lfs server, it was only trying to find the blob in the local store. Writes to the dummyremote (file based store) use local.read(), which looks at both the usercache and local store.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 02 Jan 2018 21:46:57 -0500
parents 83903433c2eb
children f43dc62cfe11
files hgext/lfs/blobstore.py tests/test-lfs-test-server.t
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py	Tue Jan 02 21:18:30 2018 -0500
+++ b/hgext/lfs/blobstore.py	Tue Jan 02 21:46:57 2018 -0500
@@ -262,9 +262,9 @@
         request = util.urlreq.request(href)
         if action == 'upload':
             # If uploading blobs, read data from local blobstore.
-            with localstore.vfs(oid) as fp:
+            with localstore.open(oid) as fp:
                 _verifyfile(oid, fp)
-            request.data = filewithprogress(localstore.vfs(oid), None)
+            request.data = filewithprogress(localstore.open(oid), None)
             request.get_method = lambda: 'PUT'
 
         for k, v in headers:
--- a/tests/test-lfs-test-server.t	Tue Jan 02 21:18:30 2018 -0500
+++ b/tests/test-lfs-test-server.t	Tue Jan 02 21:46:57 2018 -0500
@@ -38,7 +38,11 @@
   $ echo THIS-IS-LFS > a
   $ hg commit -m a -A a
 
+A push can be serviced directly from the usercache if it isn't in the local
+store.
+
   $ hg init ../repo2
+  $ mv .hg/store/lfs .hg/store/lfs_
   $ hg push ../repo2 -v
   pushing to ../repo2
   searching for changes
@@ -54,6 +58,7 @@
   adding file changes
   added 1 changesets with 1 changes to 1 files
   calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
+  $ mv .hg/store/lfs_ .hg/store/lfs
 
 Clear the cache to force a download
   $ rm -rf `hg config lfs.usercache`