# HG changeset patch # User Matt Harbison # Date 2018-01-03 02:46:57 # Node ID e8f80529abeb7410ffc22ab79fc582f7501b57a5 # Parent 83903433c2eb735ac5177ec394a042479a3dd71c 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. diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -262,9 +262,9 @@ class _gitlfsremote(object): 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: diff --git a/tests/test-lfs-test-server.t b/tests/test-lfs-test-server.t --- a/tests/test-lfs-test-server.t +++ b/tests/test-lfs-test-server.t @@ -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`