Move fix-suggestions from RobotComment to Comment

With this change, we allow storing fix suggestions with all comment
types, not just robot comments. We have deprecated robot comments
a while ago. The frontend checks framework allows checkers to provide
fix suggestions on demand with check results. This has obsoleted the
backend integration. In this change, we mark robot comments
as deprecated in Java code.

Gerrit already allowed humans to provide fix suggestions by using
markdown codeblocks in their comments. This has some limitations,
mainly the fact that you can only provide a single suggestion per
comment and that suggestion has to be a 1:1 replacement for the range
that the comment is tied to. This vastly limits the complexity of the
edit that can be represented. A real-world example is that a user
could not suggest to call a new util class, as that would mean importing
that class (in Java).

The robot comment storage for fixes is more elaborate and has good test
coverage as well as excellent input validation. RobotComment and
HumanComment inherit from the supertype comment. Hence, we uplift the
fixSuggestions from RobotComment to Comment. Consequently, they can now
be used with draft comments, human comments and robot comments.

The main diff of this change come from added test code. We decided to
copy some of the robot comments test code instead of trying to generalize
it to run on all types of comments beacause otherwise, we'd have to untangle
that generalization when we delete the robot comments code.

This change adds a new field (fix suggestions) to comments. Comments are
serialized as JSON in NoteDb and we ignore unknown fields. So this change
should be safe in terms of staged rollout failures. However, to be extra
safe, we are creating a follow up change that gates writing the new field
by an experiment parameter. The changes will be submitted together.

Forward-Compatible: checked
Release-Notes: Allow fix-suggestions with human comments
Change-Id: I0248d7842f3d742742b983c7b353585ea7dc7056
33 files changed
tree: c66880c3872ca6507898c7e03d80e4d40b23cee0
  1. .settings/
  2. .ts-out/
  3. antlr3/
  4. contrib/
  5. Documentation/
  6. e2e-tests/
  7. java/
  8. javatests/
  9. lib/
  10. modules/
  11. plugins/
  12. polygerrit-ui/
  13. prolog/
  14. prologtests/
  15. proto/
  16. resources/
  17. tools/
  18. webapp/
  19. .bazelignore
  20. .bazelproject
  21. .bazelrc
  22. .bazelversion
  23. .editorconfig
  24. .git-blame-ignore-revs
  25. .gitignore
  26. .gitmodules
  27. .gitreview
  28. .pydevproject
  29. .zuul.yaml
  30. BUILD
  31. COPYING
  32. INSTALL
  33. Jenkinsfile
  34. MODULE.bazel
  35. package.json
  36. README.md
  37. SUBMITTING_PATCHES
  38. version.bzl
  39. web-dev-server.config.mjs
  40. WORKSPACE
  41. yarn.lock
README.md

Gerrit Code Review

Gerrit is a code review and project management tool for Git based projects.

Build Status Maven Central

Objective

Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.

Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer.

Documentation

For information about how to install and use Gerrit, refer to the documentation.

Source

Our canonical Git repository is located on googlesource.com. There is a mirror of the repository on Github.

Reporting bugs

Please report bugs on the issue tracker.

Contribute

Gerrit is the work of hundreds of contributors. We appreciate your help!

Please read the contribution guidelines.

Note that we do not accept Pull Requests via the Github mirror.

Getting in contact

The Developer Mailing list is repo-discuss on Google Groups.

License

Gerrit is provided under the Apache License 2.0.

Build

Install Bazel and run the following:

    git clone --recurse-submodules https://gerrit.googlesource.com/gerrit
    cd gerrit && bazel build release

Install binary packages (Deb/Rpm)

The instruction how to configure GerritForge/BinTray repositories is here

On Debian/Ubuntu run:

    apt-get update && apt-get install gerrit=<version>-<release>

NOTE: release is a counter that starts with 1 and indicates the number of packages that have been released with the same version of the software.

On CentOS/RedHat run:

    yum clean all && yum install gerrit-<version>[-<release>]

On Fedora run:

    dnf clean all && dnf install gerrit-<version>[-<release>]

Use pre-built Gerrit images on Docker

Docker images of Gerrit are available on DockerHub

To run a CentOS 8 based Gerrit image:

    docker run -p 8080:8080 gerritcodereview/gerrit[:version]-centos8

To run a Ubuntu 20.04 based Gerrit image:

    docker run -p 8080:8080 gerritcodereview/gerrit[:version]-ubuntu20

NOTE: release is optional. Last released package of the version is installed if the release number is omitted.