[PATCH 1 of 3] identify: change p1/p2 to a list of parents
Yuya Nishihara
yuya at tcha.org
Mon Jun 26 01:48:02 UTC 2017
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1498436335 -32400
# Mon Jun 26 09:18:55 2017 +0900
# Node ID 556d2afe74385fe2a6dd7cdff5651080a827813f
# Parent a49ab7f5e7e765a94a1dfab2ee3b1da695789eb6
identify: change p1/p2 to a list of parents
It makes sense because the nested data structure is a list of items.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2790,12 +2790,12 @@ def identify(ui, repo, source=None, rev=
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:
diff --git a/tests/test-identify.t b/tests/test-identify.t
--- a/tests/test-identify.t
+++ b/tests/test-identify.t
@@ -51,7 +51,7 @@ with options
"dirty": "",
"id": "cb9a9f314b8b",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "p1": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
+ "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
"tags": ["tip"]
}
]
@@ -69,7 +69,7 @@ with modifications
"dirty": "+",
"id": "cb9a9f314b8b+",
"node": "ffffffffffffffffffffffffffffffffffffffff",
- "p1": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
+ "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
"tags": ["tip"]
}
]
diff --git a/tests/test-merge-default.t b/tests/test-merge-default.t
--- a/tests/test-merge-default.t
+++ b/tests/test-merge-default.t
@@ -57,8 +57,7 @@ Should succeed:
"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"]
}
]
More information about the Mercurial-devel
mailing list