Make all callers of ChangedFiles go through getOrCompute

Earlier it was required to pass in the RevWalk instance into
ChangedFiles when validating newly created commits, because commits
that were newly created in the CreateChange REST endpoint where only
visible through the specific RevWalk instance that was used when
creating the commit (any newly created RevWalk instance was not seeing
the commit and any attempt to look it up failed with a
MissingObjectException). Due to this the validation could not use the
new diff cache (aka DiffOperations), as the new diff cache didn't allow
to pass in a RevWalk instance.

Since passing in a RevWalk instance is no longer needed (see change
Ie8d447b79 and change I489c26ac3) we can now also use the new diff cache
for the validation.

With this change all callers of ChangedFiles use the getOrCompute
methods now. The getOrCompute methods will either retrieve the changed
files from the new diff cache or compute them newly depending on the
setting for the CodeOwnersExperimentFeaturesConstants#USE_DIFF_CACHE
experiment flag. At the moment using the new diff cache is disabled by
default, but once we are sure that its performance is fine, we will make
the switch to always use it. Then we will also want to drop the code for
computing changed files on our own.

While we are at this, remove the PatchListNotAvailableException from the
method signatures as this exception is never thrown.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ie703498f2ad39e8a9802c143364e63b5a7ac6b2a
8 files changed
tree: b64bb7c2872b4d0674afed88ab2cf0dceeb9fe44
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. test/
  6. ui/
  7. .eslintrc.json
  8. .gitignore
  9. .gitreview
  10. bower.json
  11. BUILD
  12. LICENSE
  13. package-lock.json
  14. package.json
  15. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

Also see resources/Documentation/about.md.

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.