Mercurial > hg
changeset 49315:2f326ea19fbc stable
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.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 12 May 2022 13:53:50 +0400 |
parents | ec3f88480dbf |
children | 3d3d7fc6035a |
files | mercurial/logcmdutil.py tests/test-issue6642.t tests/test-phases.t |
diffstat | 3 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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