Specify the revision from which code owner configs should be read

At the moment code owner configs are always read from the current
revision of the branch. This is problematic when we iterate over
multiple code owner configs to compute the code owners for a path if the
branch is updated while the request is running. Then some code owner
configs are read from the old revision and some code owner configs are
read from the new revision, making the result inconsistent. To fix this
we retrieve the branch revision at the beginning of the request and then
use this revision for all code owner config lookups, so that concurrent
updates of the branch have no effect on the request.

Inside code owner backends we pass the revision as a nullable field
where non-null means that the code owner config should be loaded from
that revision, and null means that the code owner config should be
loaded from the current revision. Outside of code owner backends the
revision field must always be set if present, so that callers do not
accidentally forget to set it and then run into a race condition as
described above. In cases where it makes sense to retrieve code owner
configs from the current revision, we offer dedicated methods with
explicit names for this, e.g.
CodeOwners.getFromCurrentRevision(CodeOwnerConfig.Key).

Change-Id: I5a735d49663e44be1bdfe8a386fe2d2d08bea44f
Signed-off-by: Edwin Kempin <ekempin@google.com>
19 files changed
tree: 885a5719746f50d813ec68b9d15ec014533e0fc6
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. ui/
  6. .eslintrc.json
  7. .gitreview
  8. BUILD
  9. LICENSE
  10. package.json
  11. 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