identify: change p1/p2 to a list of parents
It makes sense because the nested data structure is a list of items.
--- a/mercurial/commands.py Sun Jun 25 13:31:56 2017 -0700
+++ b/mercurial/commands.py Mon Jun 26 09:18:55 2017 +0900
@@ -2790,12 +2790,12 @@
numoutput = ["%d" % p.rev() for p in parents]
output.append("%s%s" % ('+'.join(numoutput), dirty))
- for i, p in enumerate(parents):
- fn = fm.nested('p%d' % (i + 1))
+ fn = fm.nested('parents')
+ for p in parents:
fn.startitem()
fn.data(rev=p.rev())
fn.data(node=p.hex())
- fn.end()
+ fn.end()
else:
hexoutput = hexfunc(ctx.node())
if default or id:
--- a/tests/test-identify.t Sun Jun 25 13:31:56 2017 -0700
+++ b/tests/test-identify.t Mon Jun 26 09:18:55 2017 +0900
@@ -51,7 +51,7 @@
"dirty": "",
"id": "cb9a9f314b8b",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "p1": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
+ "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
"tags": ["tip"]
}
]
@@ -69,7 +69,7 @@
"dirty": "+",
"id": "cb9a9f314b8b+",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "p1": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
+ "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
"tags": ["tip"]
}
]
--- a/tests/test-merge-default.t Sun Jun 25 13:31:56 2017 -0700
+++ b/tests/test-merge-default.t Mon Jun 26 09:18:55 2017 +0900
@@ -57,8 +57,7 @@
"dirty": "+",
"id": "f25cbe84d8b3+2d95304fed5d+",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "p1": [{"node": "f25cbe84d8b320e298e7703f18a25a3959518c23", "rev": 4}],
- "p2": [{"node": "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab", "rev": 2}],
+ "parents": [{"node": "f25cbe84d8b320e298e7703f18a25a3959518c23", "rev": 4}, {"node": "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab", "rev": 2}],
"tags": ["tip"]
}
]