Add change message with the owned files when code owner is added as reviewer

When a code owner is added as a reviewer add a change message that lists
the paths that are owned by this user. This way it gets transparent
which files can be approved by this reviewer.

Gerrit core doesn’t add a change message when a reviewer is added to a
change. Hence there is no message that we can extend, but we rather must
post our own change message.

The paths in the change message are absolute file paths. They do not
have a leading '/' so that they match the paths in the file list on the
change screen which also do not have a leading '/'.

Example change message:

"John Doe who was added as reviewer owns the following files:
* foo/bar.baz
* foo/baz.bar
* foo/bar/baz.foo"

Same as for the message posted by CodeOwnersOnPostReview the
'plugin.code-owners.maxPathsInChangeMessages' configuration parameter
limits the paths that are included into the message.

The change message is posted with a autogenerated tag so that these
messages do not show up by default on the change screen, as they may be
perceived as too verbose otherwise.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ifc79fce2ba5e8295a9c4b66feaa959245cbe7cc9
6 files changed
tree: 02362039962ab74434eee7655328baf74810c68f
  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