Mercurial > hg-stable
changeset 39641:10c5eacd793f
identify: use fm.hexfunc thoroughly
This fixes the length of {id} in JSON and template outputs.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 01 Sep 2018 12:09:22 +0900 |
parents | 713085b45810 |
children | 6ecfd12f09cd |
files | mercurial/commands.py tests/test-identify.t tests/test-merge-default.t |
diffstat | 3 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Sep 01 15:52:18 2018 +0900 +++ b/mercurial/commands.py Sat Sep 01 12:09:22 2018 +0900 @@ -2983,10 +2983,6 @@ raise error.Abort(_("there is no Mercurial repository here " "(.hg not found)")) - if ui.debugflag: - hexfunc = hex - else: - hexfunc = short default = not (num or id or branch or tags or bookmarks) output = [] revs = [] @@ -3010,7 +3006,7 @@ rev = "tip" remoterev = peer.lookup(rev) - hexrev = hexfunc(remoterev) + hexrev = fm.hexfunc(remoterev) if default or id: output = [hexrev] fm.data(id=hexrev) @@ -3053,7 +3049,7 @@ dirty = '+' fm.data(dirty=dirty) - hexoutput = [hexfunc(p.node()) for p in parents] + hexoutput = [fm.hexfunc(p.node()) for p in parents] if default or id: output = ["%s%s" % ('+'.join(hexoutput), dirty)] fm.data(id="%s%s" % ('+'.join(hexoutput), dirty)) @@ -3070,7 +3066,7 @@ fn.context(ctx=p) fn.end() else: - hexoutput = hexfunc(ctx.node()) + hexoutput = fm.hexfunc(ctx.node()) if default or id: output = [hexoutput] fm.data(id=hexoutput)
--- a/tests/test-identify.t Sat Sep 01 15:52:18 2018 +0900 +++ b/tests/test-identify.t Sat Sep 01 12:09:22 2018 +0900 @@ -49,7 +49,7 @@ "bookmarks": [], "branch": "default", "dirty": "", - "id": "cb9a9f314b8b", + "id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "node": "ffffffffffffffffffffffffffffffffffffffff", "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}], "tags": ["tip"] @@ -71,7 +71,7 @@ $ hg id -T '{tags}\n' tip - $ hg id -T '{revset("null:.") % "{rev}:{node|short} {tags} {id}\n"}' + $ hg id -T '{revset("null:.") % "{rev}:{node|short} {tags} {id|short}\n"}' -1:000000000000 cb9a9f314b8b 0:cb9a9f314b8b tip cb9a9f314b8b @@ -86,7 +86,7 @@ "bookmarks": [], "branch": "default", "dirty": "+", - "id": "cb9a9f314b8b+", + "id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b+", "node": "ffffffffffffffffffffffffffffffffffffffff", "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}], "tags": ["tip"]
--- a/tests/test-merge-default.t Sat Sep 01 15:52:18 2018 +0900 +++ b/tests/test-merge-default.t Sat Sep 01 12:09:22 2018 +0900 @@ -55,7 +55,7 @@ "bookmarks": [], "branch": "default", "dirty": "+", - "id": "f25cbe84d8b3+2d95304fed5d+", + "id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+", "node": "ffffffffffffffffffffffffffffffffffffffff", "parents": [{"node": "f25cbe84d8b320e298e7703f18a25a3959518c23", "rev": 4}, {"node": "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab", "rev": 2}], "tags": ["tip"] @@ -82,7 +82,7 @@ { "bookmarks": [], "branch": "default", - "id": "1846eede8b68", + "id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1", "tags": [] }