diff hgext/lfs/blobstore.py @ 35477:02f54a1ec9eb

lfs: add note messages indicating what store holds the lfs blob The following corruption related patches were written prior to adding the user level cache, and it took awhile to track down why the tests changed. (It generally made things more resilient.) But I think this will be useful to the end user as well. I didn't make it --debug level, because there can be a ton of info coming out of clone/push/pull --debug. The pointers are sorted for test stability. I opted for ui.note() instead of checking ui.verbose and then using ui.write() for convenience, but I see most of this extension does the latter. I have no idea what the preferred form is.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 19 Dec 2017 17:53:44 -0500
parents e333d27514b0
children b0c01a5ee35c
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py	Wed Dec 20 20:46:33 2017 -0500
+++ b/hgext/lfs/blobstore.py	Tue Dec 19 17:53:44 2017 -0500
@@ -96,6 +96,7 @@
         self.vfs = lfsvfs(fullpath)
         usercache = lfutil._usercachedir(repo.ui, 'lfs')
         self.cachevfs = lfsvfs(usercache)
+        self.ui = repo.ui
 
     def write(self, oid, data):
         """Write blob to local blobstore."""
@@ -105,12 +106,16 @@
         # XXX: should we verify the content of the cache, and hardlink back to
         # the local store on success, but truncate, write and link on failure?
         if not self.cachevfs.exists(oid):
+            self.ui.note(_('lfs: adding %s to the usercache\n') % oid)
             lfutil.link(self.vfs.join(oid), self.cachevfs.join(oid))
 
     def read(self, oid):
         """Read blob from local blobstore."""
         if not self.vfs.exists(oid):
             lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid))
+            self.ui.note(_('lfs: found %s in the usercache\n') % oid)
+        else:
+            self.ui.note(_('lfs: found %s in the local lfs store\n') % oid)
         return self.vfs.read(oid)
 
     def has(self, oid):