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
--- a/mercurial/commands.py Sat Sep 01 12:09:22 2018 +0900
+++ b/mercurial/commands.py Sat Sep 01 12:15:02 2018 +0900
@@ -3058,13 +3058,8 @@
numoutput = ["%d" % p.rev() for p in parents]
output.append("%s%s" % ('+'.join(numoutput), dirty))
- fn = fm.nested('parents', tmpl='{rev}:{node|formatnode}', sep=' ')
- for p in parents:
- fn.startitem()
- fn.data(rev=p.rev())
- fn.data(node=p.hex())
- fn.context(ctx=p)
- fn.end()
+ fm.data(parents=fm.formatlist([fm.hexfunc(p.node())
+ for p in parents], name='node'))
else:
hexoutput = fm.hexfunc(ctx.node())
if default or id:
--- a/tests/test-identify.t Sat Sep 01 12:09:22 2018 +0900
+++ b/tests/test-identify.t Sat Sep 01 12:15:02 2018 +0900
@@ -51,7 +51,7 @@
"dirty": "",
"id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
+ "parents": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
"tags": ["tip"]
}
]
@@ -63,7 +63,7 @@
$ hg id -T '{parents % "{rev} {node|shortest} {desc}\n"}'
0 cb9a a
$ hg id -T '{parents}\n'
- 0:cb9a9f314b8b
+ cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
test nested template: '{tags}'/'{node}' constants shouldn't override the
default keywords, but '{id}' persists because there's no default keyword
@@ -88,7 +88,7 @@
"dirty": "+",
"id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b+",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
+ "parents": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
"tags": ["tip"]
}
]
--- a/tests/test-merge-default.t Sat Sep 01 12:09:22 2018 +0900
+++ b/tests/test-merge-default.t Sat Sep 01 12:15:02 2018 +0900
@@ -57,7 +57,7 @@
"dirty": "+",
"id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "parents": [{"node": "f25cbe84d8b320e298e7703f18a25a3959518c23", "rev": 4}, {"node": "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab", "rev": 2}],
+ "parents": ["f25cbe84d8b320e298e7703f18a25a3959518c23", "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab"],
"tags": ["tip"]
}
]