Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 39626:6ecfd12f09cd
identify: change {parents} to a list of nodes (BC)
This is a part of the name unification. {parents} is a list of nodes in
"hg log -Tjson" output. Since {rev} can be computed from (repo, node) pair,
we no longer need to put it to provide {rev} to user templates.
https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 01 Sep 2018 12:15:02 +0900 |
parents | 10c5eacd793f |
children | ee7ee0c516ca |
comparison
equal
deleted
inserted
replaced
39625:10c5eacd793f | 39626:6ecfd12f09cd |
---|---|
3056 | 3056 |
3057 if num: | 3057 if num: |
3058 numoutput = ["%d" % p.rev() for p in parents] | 3058 numoutput = ["%d" % p.rev() for p in parents] |
3059 output.append("%s%s" % ('+'.join(numoutput), dirty)) | 3059 output.append("%s%s" % ('+'.join(numoutput), dirty)) |
3060 | 3060 |
3061 fn = fm.nested('parents', tmpl='{rev}:{node|formatnode}', sep=' ') | 3061 fm.data(parents=fm.formatlist([fm.hexfunc(p.node()) |
3062 for p in parents: | 3062 for p in parents], name='node')) |
3063 fn.startitem() | |
3064 fn.data(rev=p.rev()) | |
3065 fn.data(node=p.hex()) | |
3066 fn.context(ctx=p) | |
3067 fn.end() | |
3068 else: | 3063 else: |
3069 hexoutput = fm.hexfunc(ctx.node()) | 3064 hexoutput = fm.hexfunc(ctx.node()) |
3070 if default or id: | 3065 if default or id: |
3071 output = [hexoutput] | 3066 output = [hexoutput] |
3072 fm.data(id=hexoutput) | 3067 fm.data(id=hexoutput) |