Improve performance of looking up some SCMTool flags.

Review Request #11131 — Created Aug. 10, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

We had some call sites that inspected flags on a repository's SCMTool,
in order to handle some logic or relay capabilities elsewhere. Some of
these call sites were fetching the tool directly, in some cases
instantiating it, and then accessing the flags. For instance, there were
many blocks of code accessing SCMTool.diffs_use_absolute_paths
inefficiently.

We already had wrappers in Repository for accessing some of these
flags, which was more efficient. These looked up by class when possible,
instantiating only if necessary. In other cases, the flags could be
looked up on the class, rather than needing an instance.

This change updates all references to use the wrappers in the
Repository. It also makes the Repository.diffs_use_absolute_paths
wrapper properly a cached_property, to avoid repeated lookups and
instantiations.

Unit tests pass.

Commits

Files

    Loading...