mercurial/commands.py
branchstable
changeset 26826 39dbf495880b
parent 26818 c7d30fdb13b2
child 26874 853154f27525
child 26959 ed5f20f9c22e
equal deleted inserted replaced
26825:78539633acf3 26826:39dbf495880b
  3035     if numrevs - numfull > 0:
  3035     if numrevs - numfull > 0:
  3036         deltasize[2] /= numrevs - numfull
  3036         deltasize[2] /= numrevs - numfull
  3037     totalsize = fulltotal + deltatotal
  3037     totalsize = fulltotal + deltatotal
  3038     avgchainlen = sum(chainlengths) / numrevs
  3038     avgchainlen = sum(chainlengths) / numrevs
  3039     maxchainlen = max(chainlengths)
  3039     maxchainlen = max(chainlengths)
  3040     compratio = totalrawsize / totalsize
  3040     compratio = 1
       
  3041     if totalsize:
       
  3042         compratio = totalrawsize / totalsize
  3041 
  3043 
  3042     basedfmtstr = '%%%dd\n'
  3044     basedfmtstr = '%%%dd\n'
  3043     basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
  3045     basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n'
  3044 
  3046 
  3045     def dfmtstr(max):
  3047     def dfmtstr(max):
  3046         return basedfmtstr % len(str(max))
  3048         return basedfmtstr % len(str(max))
  3047     def pcfmtstr(max, padding=0):
  3049     def pcfmtstr(max, padding=0):
  3048         return basepcfmtstr % (len(str(max)), ' ' * padding)
  3050         return basepcfmtstr % (len(str(max)), ' ' * padding)
  3049 
  3051 
  3050     def pcfmt(value, total):
  3052     def pcfmt(value, total):
  3051         return (value, 100 * float(value) / total)
  3053         if total:
       
  3054             return (value, 100 * float(value) / total)
       
  3055         else:
       
  3056             return value, 100.0
  3052 
  3057 
  3053     ui.write(('format : %d\n') % format)
  3058     ui.write(('format : %d\n') % format)
  3054     ui.write(('flags  : %s\n') % ', '.join(flags))
  3059     ui.write(('flags  : %s\n') % ', '.join(flags))
  3055 
  3060 
  3056     ui.write('\n')
  3061     ui.write('\n')