Patchwork [4,of,4,V2] lfs: enable the final download count status message

login
register
mail settings
Submitter Matt Harbison
Date April 16, 2018, 7:07 p.m.
Message ID <b6ebe7d35f7f3c72ff43.1523905632@MATT7H-PC.attotech.com>
Download mbox | patch
Permalink /patch/31100/
State Accepted
Headers show

Comments

Matt Harbison - April 16, 2018, 7:07 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1523754995 14400
#      Sat Apr 14 21:16:35 2018 -0400
# Node ID b6ebe7d35f7f3c72ff43dc306988c235f9ebc900
# Parent  317c4321147ef610a2f229dd87953829d7eebf3d
lfs: enable the final download count status message

At this point, I think all of the core commands are prefetching, except grep and
verify.  Verify will need some special handling, in case the revlogs are
corrupt.

Grep has an issue that still needs to be debugged, but we probably need to give
the behavior some thought too- it would be a shame to have to download
everything in order to search.  I think the benefit of having this info for all
commands outweighs extra printing in a command that is arguably not well
behaved in this context anyway.

Patch

diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -451,10 +451,9 @@  class _gitlfsremote(object):
             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)))
+            elif action == 'download':
+                self.ui.status(_('lfs: downloaded %d files (%s)\n')
+                               % (blobs, util.bytecount(processed)))
 
     def __del__(self):
         # copied from mercurial/httppeer.py
diff --git a/tests/test-lfs-serve-access.t b/tests/test-lfs-serve-access.t
--- a/tests/test-lfs-serve-access.t
+++ b/tests/test-lfs-serve-access.t
@@ -135,6 +135,7 @@  Blob URIs are correct when --prefix is u
   Server: testing stub value
   lfs: adding f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e to the usercache
   lfs: processed: f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e
+  lfs: downloaded 1 files (20 bytes)
    lfs.bin: remote created -> g
   getting lfs.bin
   lfs: found f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e in the local lfs store
diff --git a/tests/test-lfs-serve.t b/tests/test-lfs-serve.t
--- a/tests/test-lfs-serve.t
+++ b/tests/test-lfs-serve.t
@@ -282,6 +282,7 @@  lfs content, and the extension enabled.
   lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
   lfs: downloading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes)
   lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de
+  lfs: downloaded 1 files (25 bytes)
   getting lfs2.txt
   lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
   getting nonlfs2.txt
@@ -326,6 +327,7 @@  Export will prefetch all needed files ac
   lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
   lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
   lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
+  lfs: downloaded 4 files (92 bytes)
   all.export
   lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
   lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
@@ -341,6 +343,7 @@  Export with selected files is used with 
   lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
   lfs: downloading bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc (23 bytes)
   lfs: processed: bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc
+  lfs: downloaded 1 files (23 bytes)
   */hg-8374dc4052cb.patch (glob)
   lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
   */hg-9640b57e77b1.patch (glob)
@@ -380,6 +383,7 @@  Diff will prefetch files
   lfs: processed: cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782
   lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
   lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
+  lfs: downloaded 4 files (92 bytes)
   lfs: found bed80f00180ac404b843628ab56a1c1984d6145c391cd1628a7dd7d2598d71fc in the local lfs store
   lfs: found a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de in the local lfs store
   lfs: found cf1b2787b74e66547d931b6ebe28ff63303e803cb2baa14a8f57c4383d875782 in the local lfs store
@@ -423,6 +427,7 @@  Only the files required by diff are pref
   lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs
   lfs: downloading d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e (24 bytes)
   lfs: processed: d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e
+  lfs: downloaded 1 files (24 bytes)
   lfs: found d96eda2c74b56e95cfb5ffb66b6503e198cc6fc4a09dc877de925feebc65786e in the local lfs store
   diff -r 8374dc4052cb -r 9640b57e77b1 lfspair2.bin
   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
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
@@ -192,6 +192,7 @@  Clear the cache to force a download
   Server: testing stub value (hg-server !)
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
+  lfs: downloaded 1 files (12 bytes)
    a: remote created -> g
   getting a
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
@@ -388,6 +389,7 @@  Clear the cache to force a download
   Server: testing stub value (hg-server !)
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+  lfs: downloaded 2 files (39 bytes)
    b: remote created -> g
   getting b
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
@@ -601,6 +603,7 @@  Archive will prefetch blobs in a group
   Server: testing stub value (hg-server !)
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+  lfs: downloaded 3 files (51 bytes)
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
   lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
@@ -675,6 +678,7 @@  Cat will prefetch blobs in a group
   Server: testing stub value (hg-server !)
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+  lfs: downloaded 2 files (31 bytes)
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
   THIS-IS-LFS
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
@@ -773,6 +777,7 @@  Revert will prefetch blobs in a group
   Server: testing stub value (hg-server !)
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+  lfs: downloaded 3 files (51 bytes)
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
   lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
   lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store