# HG changeset patch # User Matt Mackall # Date 2013-02-22 19:45:46 # Node ID c4ff927b6f68b29e67a0c888ca064ca7a76959f9 # Parent 5bef0655f2e9dd22200b663031377a21477213db templater: properly handle file_copies with % diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -244,8 +244,8 @@ def showfilecopies(**args): copies.append((fn, rename[0])) c = [{'name': x[0], 'source': x[1]} for x in copies] - return showlist('file_copy', c, plural='file_copies', - element='file', **args) + f = _showlist('file_copy', c, plural='file_copies', **args) + return _hybrid(f, c) # showfilecopiesswitch() displays file copies only if copy records are # provided before calling the templater, usually with a --copies @@ -256,8 +256,8 @@ def showfilecopiesswitch(**args): """ copies = args['revcache'].get('copies') or [] c = [{'name': x[0], 'source': x[1]} for x in copies] - return showlist('file_copy', c, plural='file_copies', - element='file', **args) + f = _showlist('file_copy', c, plural='file_copies', **args) + return _hybrid(f, c) def showfiledels(**args): """:file_dels: List of strings. Files removed by this changeset.""" diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -43,6 +43,9 @@ Second branch starting at nullrev: $ hg mv second fourth $ hg commit -m third -d "2020-01-01 10:01" + $ hg log --template '{file_copies % "{source} -> {name}\n"}' -r . + second -> fourth + Quoting for ui.logtemplate $ hg tip --config "ui.logtemplate={rev}\n"