changeset 5855:13ecad5e094f stable

evolve: use bytes for calling ui.write() in debugstablesortcache command Makes it work on Python 3.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 17 Mar 2021 20:13:53 +0800
parents b0f35c0a762f
children 5e62f3db141f
files hgext3rd/evolve/stablesort.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/stablesort.py	Tue Mar 16 21:35:02 2021 +0800
+++ b/hgext3rd/evolve/stablesort.py	Wed Mar 17 20:13:53 2021 +0800
@@ -336,11 +336,11 @@
     unfi = repo.unfiltered()
     revs = unfi.revs('all()')
     nbrevs = len(revs)
-    ui.write('number of revisions: %12d\n' % nbrevs)
+    ui.write(b'number of revisions: %12d\n' % nbrevs)
     merge = unfi.revs('merge()')
     nbmerge = len(merge)
     cache = unfi.stablesort
-    ui.write('number of merge:     %12d\n' % nbmerge)
+    ui.write(b'number of merge:     %12d\n' % nbmerge)
     alljumps = []
     alljumpssize = []
     for r in merge:
@@ -351,20 +351,20 @@
         alljumps.append(jumps)
         alljumpssize.append(len(jumps))
     nbjumps = sum(alljumpssize)
-    ui.write('number of jumps:     %12d\n' % nbjumps)
+    ui.write(b'number of jumps:     %12d\n' % nbjumps)
     if not nbjumps:
         return 0
     avgjumps = nbjumps / float(len(alljumpssize))
-    ui.write('average jumps:                 %6.3f\n' % avgjumps)
+    ui.write(b'average jumps:                 %6.3f\n' % avgjumps)
     alljumpssize.sort()
     medianjumps = alljumpssize[len(alljumpssize) // 2]
-    ui.write('median jumps:        %12d\n' % medianjumps)
+    ui.write(b'median jumps:        %12d\n' % medianjumps)
     tensjumps = alljumpssize[len(alljumpssize) * 9 // 10]
-    ui.write('90%% jumps:           %12d\n' % tensjumps)
+    ui.write(b'90%% jumps:           %12d\n' % tensjumps)
     centsjumps = alljumpssize[len(alljumpssize) * 99 // 100]
-    ui.write('99%% jumps:           %12d\n' % centsjumps)
-    ui.write('max jumps:           %12d\n' % max(alljumpssize))
-    ui.write('jump cache size:     %12d bytes\n' % (nbjumps * 12))
+    ui.write(b'99%% jumps:           %12d\n' % centsjumps)
+    ui.write(b'max jumps:           %12d\n' % max(alljumpssize))
+    ui.write(b'jump cache size:     %12d bytes\n' % (nbjumps * 12))
 
 def stablesort_branchpoint(repo, revs, mergecallback=None):
     """return '::revs' topologically sorted in "stable" order