D2225: progress: determine padding width portably

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Feb 13 16:13:31 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2225

AFFECTED FILES
  mercurial/progress.py

CHANGE DETAILS

diff --git a/mercurial/progress.py b/mercurial/progress.py
--- a/mercurial/progress.py
+++ b/mercurial/progress.py
@@ -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:



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list