hgext/fastannotate/formatter.py
changeset 49284 d44e3c45f0e4
parent 48946 642e31cb55f0
equal deleted inserted replaced
49283:44b26349127b 49284:d44e3c45f0e4
    91             maxwidth = max(widths) if widths else 0
    91             maxwidth = max(widths) if widths else 0
    92             maxwidths.append(maxwidth)
    92             maxwidths.append(maxwidth)
    93 
    93 
    94         # buffered output
    94         # buffered output
    95         result = b''
    95         result = b''
    96         for i in pycompat.xrange(len(annotatedresult)):
    96         for i in range(len(annotatedresult)):
    97             for j, p in enumerate(pieces):
    97             for j, p in enumerate(pieces):
    98                 sep = self.funcmap[j][1]
    98                 sep = self.funcmap[j][1]
    99                 padding = b' ' * (maxwidths[j] - len(p[i]))
    99                 padding = b' ' * (maxwidths[j] - len(p[i]))
   100                 result += sep + padding + p[i]
   100                 result += sep + padding + p[i]
   101             if lines:
   101             if lines:
   146 
   146 
   147         seps = [b','] * len(pieces[:-1]) + [b'']
   147         seps = [b','] * len(pieces[:-1]) + [b'']
   148 
   148 
   149         result = b''
   149         result = b''
   150         lasti = len(annotatedresult) - 1
   150         lasti = len(annotatedresult) - 1
   151         for i in pycompat.xrange(len(annotatedresult)):
   151         for i in range(len(annotatedresult)):
   152             result += b'\n {\n'
   152             result += b'\n {\n'
   153             for j, p in enumerate(pieces):
   153             for j, p in enumerate(pieces):
   154                 k, vs = p
   154                 k, vs = p
   155                 result += b'  "%s": %s%s\n' % (
   155                 result += b'  "%s": %s%s\n' % (
   156                     k,
   156                     k,