# HG changeset patch # User Matt Harbison <matt_harbi...@yahoo.com> # Date 1514947617 18000 # Tue Jan 02 21:46:57 2018 -0500 # Node ID 44931c485edcd82b0a90fb70c5294a2dc55edc16 # Parent b8a794103bbb0506069f2b0ad101ba6b0455dc26 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 @@ 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` _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel