D5014: py3: use %d in a few places

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Oct 12 17:25:29 UTC 2018


indygreg 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/D5014

AFFECTED FILES
  mercurial/statprof.py

CHANGE DETAILS

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -360,11 +360,11 @@
     with open(path, 'w+') as file:
         file.write("%f %f\n" % state.accumulated_time)
         for sample in state.samples:
-            time = str(sample.time)
+            time = sample.time
             stack = sample.stack
             sites = ['\1'.join([s.path, str(s.lineno), s.function])
                      for s in stack]
-            file.write("%s\0%s\n" % (time, '\0'.join(sites)))
+            file.write("%d\0%s\n" % (time, '\0'.join(sites)))
 
 def load_data(path):
     lines = open(path, 'r').read().splitlines()
@@ -566,7 +566,7 @@
                 stattuple = (stat.selfpercent(), stat.selfseconds(),
                              stat.site.lineno, source)
 
-                print('%33.0f%% %6.2f   line %s: %s' % (stattuple), file=fp)
+                print('%33.0f%% %6.2f   line %d: %s' % (stattuple), file=fp)
 
 def display_about_method(data, fp, function=None, **kwargs):
     if function is None:
@@ -734,7 +734,7 @@
             lines[line] = 1
 
     for line, count in lines.iteritems():
-        file.write("%s %s\n" % (line, count))
+        file.write("%s %d\n" % (line, count))
 
     file.close()
 



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


More information about the Mercurial-devel mailing list