[PATCH] annotate: remove redundant check for empty list of annotation data
Yuya Nishihara
yuya at tcha.org
Tue Sep 16 11:02:33 CDT 2014
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1409281799 -7200
# Fri Aug 29 05:09:59 2014 +0200
# Node ID aa4f7635b201f3eef77c7777d0a831c6cc068616
# Parent 161fd3b412acce6ff0d364d41618bd1a627b3877
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.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -323,12 +323,11 @@ def annotate(ui, repo, *pats, **opts):
pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x)
for x, w in sized])
- if pieces:
- for p, l in zip(zip(*pieces), lines):
- ui.write("%s: %s" % ("".join(p), l[1]))
-
- if lines and not lines[-1][1].endswith('\n'):
- ui.write('\n')
+ for p, l in zip(zip(*pieces), lines):
+ ui.write("%s: %s" % ("".join(p), l[1]))
+
+ if lines and not lines[-1][1].endswith('\n'):
+ ui.write('\n')
@command('archive',
[('', 'no-decode', None, _('do not pass files through decoders')),
More information about the Mercurial-devel
mailing list