progress: determine padding width portably
authorAugie Fackler <augie@google.com>
Tue, 13 Feb 2018 08:43:14 -0500
changeset 36151 d541042f32f6
parent 36150 fa4d333cac58
child 36152 7f5108e58083
progress: determine padding width portably Differential Revision: https://phab.mercurial-scm.org/D2225
mercurial/progress.py
--- a/mercurial/progress.py	Tue Feb 13 08:41:42 2018 -0500
+++ b/mercurial/progress.py	Tue Feb 13 08:43:14 2018 -0500
@@ -119,8 +119,8 @@
                 add = topic
             elif indicator == 'number':
                 if total:
-                    add = ('% ' + str(len(str(total))) +
-                           's/%s') % (pos, total)
+                    padamount = '%d' % len(str(total))
+                    add = ('% '+ padamount + 's/%s') % (pos, total)
                 else:
                     add = str(pos)
             elif indicator.startswith('item') and item: