Patchwork lfs: add a comment to describe subtle local blobstore open() behavior

login
register
mail settings
Submitter Matt Harbison
Date Jan. 6, 2018, 3:28 a.m.
Message ID <410d48b16de6db0f2500.1515209306@Envy>
Download mbox | patch
Permalink /patch/26578/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 6, 2018, 3:28 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1515206909 18000
#      Fri Jan 05 21:48:29 2018 -0500
# Node ID 410d48b16de6db0f2500264e8d5952bad6a5df27
# Parent  8b958d21b19d659f3d8d802b327cec58095f8e7a
lfs: add a comment to describe subtle local blobstore open() behavior
Yuya Nishihara - Jan. 6, 2018, 7:28 a.m.
On Fri, 05 Jan 2018 22:28:26 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1515206909 18000
> #      Fri Jan 05 21:48:29 2018 -0500
> # Node ID 410d48b16de6db0f2500264e8d5952bad6a5df27
> # Parent  8b958d21b19d659f3d8d802b327cec58095f8e7a
> lfs: add a comment to describe subtle local blobstore open() behavior

Queued, thanks.

Patch

diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -103,6 +103,12 @@ 
     def open(self, oid):
         """Open a read-only file descriptor to the named blob, in either the
         usercache or the local store."""
+        # The usercache is the most likely place to hold the file.  Commit will
+        # write to both it and the local store, as will anything that downloads
+        # the blobs.  However, things like clone without an update won't
+        # populate the local store.  For an init + push of a local clone,
+        # the usercache is the only place it _could_ be.  If not present, the
+        # missing file msg here will indicate the local repo, not the usercache.
         if self.cachevfs.exists(oid):
             return self.cachevfs(oid, 'rb')