changeset 35881:fa993c3c8462

lfs: emit a status message to indicate how many blobs were uploaded Previously, there was a progress bar indicating the byte count, but then it disappeared once the transfer was done. Having that value stay on the screen seems useful. Downloads are done one at a time, so hold off on that until they can be coalesced, to avoid a series of lines being printed. (I don't have any great ideas on how to do that. It would be a shame to have to wrap a bunch of read commands to be able to do this.) I'm not sure if the 'lfs:' prefix is the right thing to do here. The others in the test are verbose/debug messages, so in the normal case, this is the only line that's prefixed.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 29 Jan 2018 22:09:48 -0500
parents 6bd2846a82e8
children 87416288be98
files hgext/lfs/blobstore.py tests/test-lfs-test-server.t
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py	Tue Jan 30 20:33:21 2018 -0500
+++ b/hgext/lfs/blobstore.py	Mon Jan 29 22:09:48 2018 -0500
@@ -366,12 +366,23 @@
             oids = transfer(sorted(objects, key=lambda o: o.get('oid')))
 
         processed = 0
+        blobs = 0
         for _one, oid in oids:
             processed += sizes[oid]
+            blobs += 1
             self.ui.progress(topic, processed, total=total)
             self.ui.note(_('lfs: processed: %s\n') % oid)
         self.ui.progress(topic, pos=None, total=total)
 
+        if blobs > 0:
+            if action == 'upload':
+                self.ui.status(_('lfs: uploaded %d files (%s)\n')
+                               % (blobs, util.bytecount(processed)))
+            # TODO: coalesce the download requests, and comment this in
+            #elif action == 'download':
+            #    self.ui.status(_('lfs: downloaded %d files (%s)\n')
+            #                   % (blobs, util.bytecount(processed)))
+
     def __del__(self):
         # copied from mercurial/httppeer.py
         urlopener = getattr(self, 'urlopener', None)
--- a/tests/test-lfs-test-server.t	Tue Jan 30 20:33:21 2018 -0500
+++ b/tests/test-lfs-test-server.t	Mon Jan 29 22:09:48 2018 -0500
@@ -48,6 +48,7 @@
   searching for changes
   lfs: uploading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
+  lfs: uploaded 1 files (12 bytes)
   1 changesets found
   uncompressed size of bundle content:
        * (changelog) (glob)
@@ -86,6 +87,7 @@
   lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
   lfs: uploading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+  lfs: uploaded 2 files (39 bytes)
   1 changesets found
   uncompressed size of bundle content:
   adding changesets