Show More
@@ -14,9 +14,13 b' import hbisect' | |||
|
14 | 14 | # "{files % '{file}\n'}" (hgweb-style with inlining and function support) |
|
15 | 15 | |
|
16 | 16 | class _hybrid(object): |
|
17 | def __init__(self, gen, values): | |
|
17 | def __init__(self, gen, values, joinfmt=None): | |
|
18 | 18 | self.gen = gen |
|
19 | 19 | self.values = values |
|
20 | if joinfmt: | |
|
21 | self.joinfmt = joinfmt | |
|
22 | else: | |
|
23 | self.joinfmt = lambda x: x.values()[0] | |
|
20 | 24 | def __iter__(self): |
|
21 | 25 | return self.gen |
|
22 | 26 | def __call__(self): |
@@ -245,7 +249,7 b' def showfilecopies(**args):' | |||
|
245 | 249 | |
|
246 | 250 | c = [{'name': x[0], 'source': x[1]} for x in copies] |
|
247 | 251 | f = _showlist('file_copy', c, plural='file_copies', **args) |
|
248 | return _hybrid(f, c) | |
|
252 | return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source'])) | |
|
249 | 253 | |
|
250 | 254 | # showfilecopiesswitch() displays file copies only if copy records are |
|
251 | 255 | # provided before calling the templater, usually with a --copies |
@@ -257,7 +261,7 b' def showfilecopiesswitch(**args):' | |||
|
257 | 261 | copies = args['revcache'].get('copies') or [] |
|
258 | 262 | c = [{'name': x[0], 'source': x[1]} for x in copies] |
|
259 | 263 | f = _showlist('file_copy', c, plural='file_copies', **args) |
|
260 | return _hybrid(f, c) | |
|
264 | return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source'])) | |
|
261 | 265 | |
|
262 | 266 | def showfiledels(**args): |
|
263 | 267 | """:file_dels: List of strings. Files removed by this changeset.""" |
@@ -228,7 +228,8 b' def join(context, mapping, args):' | |||
|
228 | 228 | |
|
229 | 229 | joinset = args[0][0](context, mapping, args[0][1]) |
|
230 | 230 | if util.safehasattr(joinset, '__call__'): |
|
231 | joinset = [x.values()[0] for x in joinset()] | |
|
231 | jf = joinset.joinfmt | |
|
232 | joinset = [jf(x) for x in joinset()] | |
|
232 | 233 | |
|
233 | 234 | joiner = " " |
|
234 | 235 | if len(args) > 1: |
@@ -43,6 +43,8 b' Second branch starting at nullrev:' | |||
|
43 | 43 | $ hg mv second fourth |
|
44 | 44 | $ hg commit -m third -d "2020-01-01 10:01" |
|
45 | 45 | |
|
46 | $ hg log --template '{join(file_copies, ",\n")}\n' -r . | |
|
47 | fourth (second) | |
|
46 | 48 |
$ |
|
47 | 49 | second -> fourth |
|
48 | 50 |
General Comments 0
You need to be logged in to leave comments.
Login now