Commit 6f04ecc6 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

annotate: handle empty files earlier

Rather than looping on funcmap and then checking for non-zero `l`
continue if the result of fctx.annotate is empty.
parent 576ff900fcc7
......@@ -469,12 +469,13 @@ def annotate(ui, repo, *pats, **opts):
lines = fctx.annotate(follow=follow, linenumber=linenumber,
if not lines:
formats = []
pieces = []
for f, sep in funcmap:
l = [f(n) for n, dummy in lines]
if l:
if fm:
formats.append(['%s' for x in l])
......@@ -488,7 +489,7 @@ def annotate(ui, repo, *pats, **opts):
fm.write(fields, "".join(f), *p)
fm.write('line', ": %s", l[1])
if lines and not lines[-1][1].endswith('\n'):
if not lines[-1][1].endswith('\n'):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment