comparison mercurial/logcmdutil.py @ 48891: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 288de6f5d724
comparison
equal deleted inserted replaced
48890:ec3f88480dbf 48891:2f326ea19fbc
375 self._showobsfate(ctx) 375 self._showobsfate(ctx)
376 376
377 self._exthook(ctx) 377 self._exthook(ctx)
378 378
379 if self.ui.debugflag: 379 if self.ui.debugflag:
380 files = ctx.p1().status(ctx)
381 for key, value in zip( 380 for key, value in zip(
382 [b'files', b'files+', b'files-'], 381 [b'files', b'files+', b'files-'],
383 [files.modified, files.added, files.removed], 382 [ctx.filesmodified(), ctx.filesadded(), ctx.filesremoved()],
384 ): 383 ):
385 if value: 384 if value:
386 self.ui.write( 385 self.ui.write(
387 columns[key] % b" ".join(value), 386 columns[key] % b" ".join(value),
388 label=b'ui.debug log.files', 387 label=b'ui.debug log.files',
510 self.ui.debugflag 509 self.ui.debugflag
511 or b'modified' in datahint 510 or b'modified' in datahint
512 or b'added' in datahint 511 or b'added' in datahint
513 or b'removed' in datahint 512 or b'removed' in datahint
514 ): 513 ):
515 files = ctx.p1().status(ctx)
516 fm.data( 514 fm.data(
517 modified=fm.formatlist(files.modified, name=b'file'), 515 modified=fm.formatlist(ctx.filesmodified(), name=b'file'),
518 added=fm.formatlist(files.added, name=b'file'), 516 added=fm.formatlist(ctx.filesadded(), name=b'file'),
519 removed=fm.formatlist(files.removed, name=b'file'), 517 removed=fm.formatlist(ctx.filesremoved(), name=b'file'),
520 ) 518 )
521 519
522 verbose = not self.ui.debugflag and self.ui.verbose 520 verbose = not self.ui.debugflag and self.ui.verbose
523 if verbose or b'files' in datahint: 521 if verbose or b'files' in datahint:
524 fm.data(files=fm.formatlist(ctx.files(), name=b'file')) 522 fm.data(files=fm.formatlist(ctx.files(), name=b'file'))