# HG changeset patch # User Yuya Nishihara # Date 1458827756 -32400 # Node ID 2d3837a4bded5362f26f91033c0a83376c207593 # Parent 790c076cd4a2c2106efb8e6fed9f3dff4c447d61 log: fix status template to list copy source per dest (issue5155) Before, copied files were assumed as "A" (added) and listed followed by non-copy added files. This could double entries of a copy if it had "M" (modified) state. So, this patch makes the template check if a file is included in copies dict. This way, entries should never be doubled. The output of "log -Tstatus -C" does not always agree with "status -C --change" due to the bug of "status", which is documented in test-status.t. See also 2963d5c9d90b. diff -r 790c076cd4a2 -r 2d3837a4bded mercurial/templates/map-cmdline.status --- a/mercurial/templates/map-cmdline.status Wed Apr 20 16:33:13 2016 +0100 +++ b/mercurial/templates/map-cmdline.status Thu Mar 24 22:55:56 2016 +0900 @@ -8,18 +8,13 @@ # Override the file templates lfiles = '{if(files, label('ui.note log.files', - 'files:\n'))}{lfile_mods}{lfile_adds}{lfile_copies_switch}{lfile_dels}' + 'files:\n'))}{lfile_mods}{lfile_adds}{lfile_dels}' -# Exclude copied files, will display those in lfile_copies_switch -lfile_adds = '{file_adds % "{ifcontains(file, file_copies_switch, - '', - '{lfile_add}')}"}' +lfile_adds = '{file_adds % "{lfile_add}{lfile_src}"}' +lfile_mods = '{file_mods % "{lfile_mod}{lfile_src}"}' lfile_add = '{label("status.added", "A {file}\n")}' - -lfile_copies_switch = '{file_copies_switch % "{lfile_copy_orig}{lfile_copy_dest}"}' -lfile_copy_orig = '{label("status.added", "A {name}\n")}' -lfile_copy_dest = '{label("status.copied", " {source}\n")}' - -lfile_mods = '{file_mods % "{label('status.modified', 'M {file}\n')}"}' +lfile_mod = '{label("status.modified", "M {file}\n")}' +lfile_src = '{ifcontains(file, file_copies_switch, + label("status.copied", " {get(file_copies_switch, file)}\n"))}' lfile_dels = '{file_dels % "{label('status.removed', 'R {file}\n')}"}' diff -r 790c076cd4a2 -r 2d3837a4bded tests/test-status.t --- a/tests/test-status.t Wed Apr 20 16:33:13 2016 +0100 +++ b/tests/test-status.t Thu Mar 24 22:55:56 2016 +0900 @@ -513,6 +513,18 @@ M a R b +using log status template (issue5155) + $ hg log -Tstatus -r 'wdir()' -C + changeset: 2147483647:ffffffffffff + parent: 0:8c55c58b4c0e + user: test + date: * (glob) + files: + M a + b + R b + + Other "bug" highlight, the revision status does not report the copy information. This is buggy behavior. @@ -521,4 +533,17 @@ M a R b +using log status template, the copy information is displayed correctly. + $ hg log -Tstatus -r. -C + changeset: 1:6685fde43d21 + tag: tip + user: test + date: * (glob) + summary: blah + files: + M a + b + R b + + $ cd ..