Mercurial > hg
comparison mercurial/commands.py @ 38358:57dc72b56b6c
annotate: automatically populate fields referenced from template
If '{line_number}' is in the template, we'll probably need it. No
--line-number option should be required in such cases.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 03 May 2018 12:04:36 +0900 |
parents | 31ed65f9c5ad |
children | 2ceea1554d1e |
comparison
equal
deleted
inserted
replaced
38357:31ed65f9c5ad | 38358:57dc72b56b6c |
---|---|
357 def makefunc(get, fmt): | 357 def makefunc(get, fmt): |
358 return lambda x: fmt(get(x)) | 358 return lambda x: fmt(get(x)) |
359 else: | 359 else: |
360 def makefunc(get, fmt): | 360 def makefunc(get, fmt): |
361 return get | 361 return get |
362 datahint = rootfm.datahint() | |
362 funcmap = [(makefunc(get, fmt), sep) for fn, sep, get, fmt in opmap | 363 funcmap = [(makefunc(get, fmt), sep) for fn, sep, get, fmt in opmap |
363 if opts.get(opnamemap.get(fn, fn))] | 364 if opts.get(opnamemap.get(fn, fn)) or fn in datahint] |
364 funcmap[0] = (funcmap[0][0], '') # no separator in front of first column | 365 funcmap[0] = (funcmap[0][0], '') # no separator in front of first column |
365 fields = ' '.join(fn for fn, sep, get, fmt in opmap | 366 fields = ' '.join(fn for fn, sep, get, fmt in opmap |
366 if opts.get(opnamemap.get(fn, fn))) | 367 if opts.get(opnamemap.get(fn, fn)) or fn in datahint) |
367 | 368 |
368 def bad(x, y): | 369 def bad(x, y): |
369 raise error.Abort("%s: %s" % (x, y)) | 370 raise error.Abort("%s: %s" % (x, y)) |
370 | 371 |
371 m = scmutil.match(ctx, pats, opts, badfn=bad) | 372 m = scmutil.match(ctx, pats, opts, badfn=bad) |