mercurial/statprof.py
changeset 46018 8b0a3ff5ed12
parent 46017 068307b638f4
child 48481 c1fe758c1530
equal deleted inserted replaced
46017:068307b638f4 46018:8b0a3ff5ed12
   766             liststring = listpattern % (
   766             liststring = listpattern % (
   767                 node.count / root.count * 100,
   767                 node.count / root.count * 100,
   768                 filename,
   768                 filename,
   769                 function,
   769                 function,
   770             )
   770             )
   771             codepattern = b'%' + (b'%d' % (55 - len(liststring))) + b's %d:  %s'
   771             # 4 to account for the word 'line'
       
   772             spacing_len = max(4, 55 - len(liststring))
       
   773             prefix = b''
       
   774             if spacing_len == 4:
       
   775                 prefix = b', '
       
   776 
       
   777             codepattern = b'%s%s %d: %s%s'
   772             codestring = codepattern % (
   778             codestring = codepattern % (
   773                 b'line',
   779                 prefix,
       
   780                 b'line'.rjust(spacing_len),
   774                 site.lineno,
   781                 site.lineno,
       
   782                 b''.ljust(max(0, 4 - len(str(site.lineno)))),
   775                 site.getsource(30),
   783                 site.getsource(30),
   776             )
   784             )
   777 
   785 
   778             finalstring = liststring + codestring
   786             finalstring = liststring + codestring
   779             childrensamples = sum(
   787             childrensamples = sum(