log: do not calculate files() if --verbose is not set

Summary:
Discovered by martinvonz. `sl log` without arguments in a Git repo spends a
lot of time on `ctx.files()` but not render them. Update the logic to check
the `--verbose` first to avoid slow `.files()` calculation.

Reviewed By: bolinfest

Differential Revision: D41343821

fbshipit-source-id: c2ad760e2749e1222c6bec7923b62310296d4d56
This commit is contained in:
Jun Wu 2022-11-16 14:06:46 -08:00 committed by Facebook GitHub Bot
parent fada6764c4
commit e68cdbba95

View File

@ -1992,7 +1992,7 @@ class changeset_printer(object):
self.ui.write(
columns[key] % " ".join(value), label="ui.debug log.files"
)
elif ctx.files() and self.ui.verbose:
elif self.ui.verbose and ctx.files():
self.ui.write(
columns["files"] % " ".join(ctx.files()), label="ui.note log.files"
)