comparison mercurial/commands.py @ 22452:75e166b82c7a

annotate: remove redundant check for empty list of annotation data It isn't necessary because zip(*pieces) returns [] if pieces are empty, and pieces are empty only if lines are empty.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 29 Aug 2014 05:09:59 +0200
parents ae1932dce9c1
children 3c8ae79eacb0
comparison
equal deleted inserted replaced
22451:186fd06283b4 22452:75e166b82c7a
321 sized = [(x, encoding.colwidth(x)) for x in l] 321 sized = [(x, encoding.colwidth(x)) for x in l]
322 ml = max([w for x, w in sized]) 322 ml = max([w for x, w in sized])
323 pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x) 323 pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x)
324 for x, w in sized]) 324 for x, w in sized])
325 325
326 if pieces: 326 for p, l in zip(zip(*pieces), lines):
327 for p, l in zip(zip(*pieces), lines): 327 ui.write("%s: %s" % ("".join(p), l[1]))
328 ui.write("%s: %s" % ("".join(p), l[1])) 328
329 329 if lines and not lines[-1][1].endswith('\n'):
330 if lines and not lines[-1][1].endswith('\n'): 330 ui.write('\n')
331 ui.write('\n')
332 331
333 @command('archive', 332 @command('archive',
334 [('', 'no-decode', None, _('do not pass files through decoders')), 333 [('', 'no-decode', None, _('do not pass files through decoders')),
335 ('p', 'prefix', '', _('directory prefix for files in archive'), 334 ('p', 'prefix', '', _('directory prefix for files in archive'),
336 _('PREFIX')), 335 _('PREFIX')),