# HG changeset patch # User Anton Shestakov # Date 1652349230 -14400 # Node ID 2f326ea19fbc27a93c9e41fe3d42bbad8d510f53 # Parent ec3f88480dbfb6c5006a9ccc785eaf00e8dcd99b logcmdutil: use the same data as {file*} template keywords (issue6642) Since 0c72eddb4be5 template keywords that show files use a different source of data than ctx.p1().status(ctx). These two functions in logcmdutil also show file lists when needed (e.g. log with --debug flag), but previously they used the old way of just looking at status compared to p1 and it resulted in differences between e.g. hg log --debug and hg log -T '{file*}'. test-phases.t needs an adjustment because 7 is a merge commit of two topological branches and one of them introduces files C, D and E. diff -r ec3f88480dbf -r 2f326ea19fbc mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py Thu May 12 13:52:10 2022 +0400 +++ b/mercurial/logcmdutil.py Thu May 12 13:53:50 2022 +0400 @@ -377,10 +377,9 @@ self._exthook(ctx) if self.ui.debugflag: - files = ctx.p1().status(ctx) for key, value in zip( [b'files', b'files+', b'files-'], - [files.modified, files.added, files.removed], + [ctx.filesmodified(), ctx.filesadded(), ctx.filesremoved()], ): if value: self.ui.write( @@ -512,11 +511,10 @@ or b'added' in datahint or b'removed' in datahint ): - files = ctx.p1().status(ctx) fm.data( - modified=fm.formatlist(files.modified, name=b'file'), - added=fm.formatlist(files.added, name=b'file'), - removed=fm.formatlist(files.removed, name=b'file'), + modified=fm.formatlist(ctx.filesmodified(), name=b'file'), + added=fm.formatlist(ctx.filesadded(), name=b'file'), + removed=fm.formatlist(ctx.filesremoved(), name=b'file'), ) verbose = not self.ui.debugflag and self.ui.verbose diff -r ec3f88480dbf -r 2f326ea19fbc tests/test-issue6642.t --- a/tests/test-issue6642.t Thu May 12 13:52:10 2022 +0400 +++ b/tests/test-issue6642.t Thu May 12 13:53:50 2022 +0400 @@ -25,11 +25,9 @@ $ hg log -r . --debug | grep files - files+: b (known-bad-output !) - [1] (missing-correct-output !) + [1] $ hg log -r . --debug -T json | egrep '(added|removed|modified)' - "added": ["b"], (known-bad-output !) - "added": [], (missing-correct-output !) + "added": [], "modified": [], "removed": [], $ hg log -r . --debug -T xml | grep path diff -r ec3f88480dbf -r 2f326ea19fbc tests/test-phases.t --- a/tests/test-phases.t Thu May 12 13:52:10 2022 +0400 +++ b/tests/test-phases.t Thu May 12 13:53:50 2022 +0400 @@ -407,7 +407,6 @@ manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8 user: test date: Thu Jan 01 00:00:00 1970 +0000 - files+: C D E extra: branch=default description: merge B' and E