lfs: use ui.note() and ui.debug() instead of ui.write() and their flags
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 21 Dec 2017 23:31:46 -0500
changeset 35478 5a73a0446afd
parent 35477 bb6a80fc969a
child 35479 8d05705bde0a
lfs: use ui.note() and ui.debug() instead of ui.write() and their flags Even though the upload/download message is still in a ui.verbose check, I switched that to ui.note() too so that the 'ui.note' label is applied. The debug message is no longer marked for translation because check-code complained.
hgext/lfs/blobstore.py
hgext/lfs/wrapper.py
--- a/hgext/lfs/blobstore.py	Thu Dec 21 14:13:39 2017 -0500
+++ b/hgext/lfs/blobstore.py	Thu Dec 21 23:31:46 2017 -0500
@@ -290,9 +290,9 @@
             sizes[obj.get('oid')] = obj.get('size', 0)
         topic = {'upload': _('lfs uploading'),
                  'download': _('lfs downloading')}[action]
-        if self.ui.verbose and len(objects) > 1:
-            self.ui.write(_('lfs: need to transfer %d objects (%s)\n')
-                          % (len(objects), util.bytecount(total)))
+        if len(objects) > 1:
+            self.ui.note(_('lfs: need to transfer %d objects (%s)\n')
+                         % (len(objects), util.bytecount(total)))
         self.ui.progress(topic, 0, total=total)
         def transfer(chunk):
             for obj in chunk:
@@ -302,8 +302,8 @@
                         msg = _('lfs: downloading %s (%s)\n')
                     elif action == 'upload':
                         msg = _('lfs: uploading %s (%s)\n')
-                    self.ui.write(msg % (obj.get('oid'),
-                                  util.bytecount(objsize)))
+                    self.ui.note(msg % (obj.get('oid'),
+                                 util.bytecount(objsize)))
                 retry = self.retry
                 while True:
                     try:
@@ -312,10 +312,9 @@
                         break
                     except socket.error as ex:
                         if retry > 0:
-                            if self.ui.verbose:
-                                self.ui.write(
-                                    _('lfs: failed: %r (remaining retry %d)\n')
-                                    % (ex, retry))
+                            self.ui.note(
+                                _('lfs: failed: %r (remaining retry %d)\n')
+                                % (ex, retry))
                             retry -= 1
                             continue
                         raise
@@ -326,8 +325,7 @@
         for _one, oid in oids:
             processed += sizes[oid]
             self.ui.progress(topic, processed, total=total)
-            if self.ui.verbose:
-                self.ui.write(_('lfs: processed: %s\n') % oid)
+            self.ui.note(_('lfs: processed: %s\n') % oid)
         self.ui.progress(topic, pos=None, total=total)
 
     def __del__(self):
--- a/hgext/lfs/wrapper.py	Thu Dec 21 14:13:39 2017 -0500
+++ b/hgext/lfs/wrapper.py	Thu Dec 21 23:31:46 2017 -0500
@@ -273,9 +273,7 @@
 
 def extractpointers(repo, revs):
     """return a list of lfs pointers added by given revs"""
-    ui = repo.ui
-    if ui.debugflag:
-        ui.write(_('lfs: computing set of blobs to upload\n'))
+    repo.ui.debug('lfs: computing set of blobs to upload\n')
     pointers = {}
     for r in revs:
         ctx = repo[r]