diff mercurial/logcmdutil.py @ 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 3b6b43a7ace4
children 79b2c98ab7b4
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