##// END OF EJS Templates
identify: use fm.hexfunc thoroughly...
Yuya Nishihara -
r39661:10c5eacd default
parent child Browse files
Show More
@@ -2983,10 +2983,6 b' def identify(ui, repo, source=None, rev='
2983 raise error.Abort(_("there is no Mercurial repository here "
2983 raise error.Abort(_("there is no Mercurial repository here "
2984 "(.hg not found)"))
2984 "(.hg not found)"))
2985
2985
2986 if ui.debugflag:
2987 hexfunc = hex
2988 else:
2989 hexfunc = short
2990 default = not (num or id or branch or tags or bookmarks)
2986 default = not (num or id or branch or tags or bookmarks)
2991 output = []
2987 output = []
2992 revs = []
2988 revs = []
@@ -3010,7 +3006,7 b' def identify(ui, repo, source=None, rev='
3010 rev = "tip"
3006 rev = "tip"
3011
3007
3012 remoterev = peer.lookup(rev)
3008 remoterev = peer.lookup(rev)
3013 hexrev = hexfunc(remoterev)
3009 hexrev = fm.hexfunc(remoterev)
3014 if default or id:
3010 if default or id:
3015 output = [hexrev]
3011 output = [hexrev]
3016 fm.data(id=hexrev)
3012 fm.data(id=hexrev)
@@ -3053,7 +3049,7 b' def identify(ui, repo, source=None, rev='
3053 dirty = '+'
3049 dirty = '+'
3054 fm.data(dirty=dirty)
3050 fm.data(dirty=dirty)
3055
3051
3056 hexoutput = [hexfunc(p.node()) for p in parents]
3052 hexoutput = [fm.hexfunc(p.node()) for p in parents]
3057 if default or id:
3053 if default or id:
3058 output = ["%s%s" % ('+'.join(hexoutput), dirty)]
3054 output = ["%s%s" % ('+'.join(hexoutput), dirty)]
3059 fm.data(id="%s%s" % ('+'.join(hexoutput), dirty))
3055 fm.data(id="%s%s" % ('+'.join(hexoutput), dirty))
@@ -3070,7 +3066,7 b' def identify(ui, repo, source=None, rev='
3070 fn.context(ctx=p)
3066 fn.context(ctx=p)
3071 fn.end()
3067 fn.end()
3072 else:
3068 else:
3073 hexoutput = hexfunc(ctx.node())
3069 hexoutput = fm.hexfunc(ctx.node())
3074 if default or id:
3070 if default or id:
3075 output = [hexoutput]
3071 output = [hexoutput]
3076 fm.data(id=hexoutput)
3072 fm.data(id=hexoutput)
@@ -49,7 +49,7 b' with options'
49 "bookmarks": [],
49 "bookmarks": [],
50 "branch": "default",
50 "branch": "default",
51 "dirty": "",
51 "dirty": "",
52 "id": "cb9a9f314b8b",
52 "id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
53 "node": "ffffffffffffffffffffffffffffffffffffffff",
53 "node": "ffffffffffffffffffffffffffffffffffffffff",
54 "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
54 "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
55 "tags": ["tip"]
55 "tags": ["tip"]
@@ -71,7 +71,7 b" for '{id}' (issue5612)"
71
71
72 $ hg id -T '{tags}\n'
72 $ hg id -T '{tags}\n'
73 tip
73 tip
74 $ hg id -T '{revset("null:.") % "{rev}:{node|short} {tags} {id}\n"}'
74 $ hg id -T '{revset("null:.") % "{rev}:{node|short} {tags} {id|short}\n"}'
75 -1:000000000000 cb9a9f314b8b
75 -1:000000000000 cb9a9f314b8b
76 0:cb9a9f314b8b tip cb9a9f314b8b
76 0:cb9a9f314b8b tip cb9a9f314b8b
77
77
@@ -86,7 +86,7 b' with modifications'
86 "bookmarks": [],
86 "bookmarks": [],
87 "branch": "default",
87 "branch": "default",
88 "dirty": "+",
88 "dirty": "+",
89 "id": "cb9a9f314b8b+",
89 "id": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b+",
90 "node": "ffffffffffffffffffffffffffffffffffffffff",
90 "node": "ffffffffffffffffffffffffffffffffffffffff",
91 "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
91 "parents": [{"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "rev": 0}],
92 "tags": ["tip"]
92 "tags": ["tip"]
@@ -55,7 +55,7 b' Should succeed:'
55 "bookmarks": [],
55 "bookmarks": [],
56 "branch": "default",
56 "branch": "default",
57 "dirty": "+",
57 "dirty": "+",
58 "id": "f25cbe84d8b3+2d95304fed5d+",
58 "id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+",
59 "node": "ffffffffffffffffffffffffffffffffffffffff",
59 "node": "ffffffffffffffffffffffffffffffffffffffff",
60 "parents": [{"node": "f25cbe84d8b320e298e7703f18a25a3959518c23", "rev": 4}, {"node": "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab", "rev": 2}],
60 "parents": [{"node": "f25cbe84d8b320e298e7703f18a25a3959518c23", "rev": 4}, {"node": "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab", "rev": 2}],
61 "tags": ["tip"]
61 "tags": ["tip"]
@@ -82,7 +82,7 b' Should succeed - 2 heads:'
82 {
82 {
83 "bookmarks": [],
83 "bookmarks": [],
84 "branch": "default",
84 "branch": "default",
85 "id": "1846eede8b68",
85 "id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
86 "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
86 "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
87 "tags": []
87 "tags": []
88 }
88 }
General Comments 0
You need to be logged in to leave comments. Login now