Patchwork D2895: py3: use "%d" % int instead of str(int)

login
register
mail settings
Submitter phabricator
Date March 19, 2018, 7:31 a.m.
Message ID <differential-rev-PHID-DREV-oslqx2k2tgavps6nyx4e-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29609/
State Superseded
Headers show

Comments

phabricator - March 19, 2018, 7:31 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We need to use bytes internally.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1133,7 +1133,7 @@ 
         fm.startitem()
         fm.write('branch', '%s', tag, label=label)
         rev = ctx.rev()
-        padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0)
+        padsize = max(31 - len("%d" % rev) - encoding.colwidth(tag), 0)
         fmt = ' ' * padsize + ' %d:%s'
         fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()),
                      label='log.changeset changeset.%s' % ctx.phasestr())