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

REVISION SUMMARY
  Due to behavioral changes between '% Ns' and '% Nd' this has some
  unfortunate extra dancing. I'm not sure of a better way to solve this
  problem.

REPOSITORY
  rHG Mercurial

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

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
@@ -120,7 +120,11 @@
             elif indicator == 'number':
                 if total:
                     padamount = '%d' % len(str(total))
-                    add = ('% '+ padamount + 's/%s') % (pos, total)
+                    # '% 1d' % 1 adds an extra space compared to '% 1s' % 1.
+                    # To avoid this change in output, we convert to a string
+                    # first, then do the padding.
+                    spos = '%d' % pos
+                    add = ('% '+ padamount + 's/%d') % (spos, total)
                 else:
                     add = str(pos)
             elif indicator.startswith('item') and item:



To: durin42, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to