templatekw: make join() escape values of extras (BC) (issue5504)

Since extras may contain blob, the default template escapes its values:

  'extra': '{key}={value|stringescape}'

join() should follow the output style of the default template.
This commit is contained in:
Yuya Nishihara 2017-03-15 23:21:30 +09:00
parent 02022fc3c5
commit 5ce2afb81d
3 changed files with 11 additions and 3 deletions

View File

@ -336,7 +336,7 @@ def showextras(**args):
c = [makemap(k) for k in extras]
f = _showlist('extra', c, plural='extras', **args)
return _hybrid(f, extras, makemap,
lambda x: '%s=%s' % (x['key'], x['value']))
lambda x: '%s=%s' % (x['key'], util.escapestr(x['value'])))
@templatekeyword('file_adds')
def showfileadds(**args):

View File

@ -582,8 +582,7 @@ The transplant case
21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
branch=dev
convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac (esc)
`h\x9b (esc)
transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
$ hg -R ../converted log -r 'origin(tip)'
changeset: 2:e0213322b2c1
user: test

View File

@ -94,6 +94,15 @@ rebase b onto r1
1 r2
0 r1
test format of transplant_source
$ hg log -r7 --debug | grep transplant_source
extra: transplant_source=\xa52Q\xcd\xf7\x17g\x9d\x19\x07\xb2\x89\xf9\x91SK\xe0\\\x99z
$ hg log -r7 -T '{extras}\n'
branch=defaulttransplant_source=\xa52Q\xcd\xf7\x17g\x9d\x19\x07\xb2\x89\xf9\x91SK\xe0\\\x99z
$ hg log -r7 -T '{join(extras, " ")}\n'
branch=default transplant_source=\xa52Q\xcd\xf7\x17g\x9d\x19\x07\xb2\x89\xf9\x91SK\xe0\\\x99z
test transplanted revset
$ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n'