diff --git a/.mailmap b/.mailmap index ae7cde9371..721f3c0cb1 100644 --- a/.mailmap +++ b/.mailmap @@ -5,6 +5,7 @@ Alex Blewitt Alex Ryazantsev alex Alex Ryazantsev alex.ryazantsev Alice Kober-Sotzek +Alexandre Philbert Andrew Bonventre Becky Siegel beckysiegel Ben Rohlfs brohlfs @@ -12,6 +13,7 @@ Brad Larson Bruce Zu Bruce Zu Carlos Eduardo Baldacin carloseduardo.baldacin +Chad Horohoe Changcheng Xiao xchangcheng Cheng Ke Dariusz Luksza @@ -29,13 +31,17 @@ Edwin Kempin Eryk Szymanski Fredrik Luthander Fredrik Luthander +Gerrit Code Review Gustaf Lundh Gustaf Lundh Gustaf Lundh Han-Wen Nienhuys +Hector Oswaldo Caballero Hugo Arès Hugo Ares +Hugo Arès Jacek Centkowski Jacek Centkowski +James E. Blair Jason Huntley jhuntley Jiří Engelthaler Joe Onorato @@ -49,16 +55,24 @@ Lincoln Oliveira Campos Do Nascimento Magnus Bäck Magnus Bäck +Marco Miller Mark Derricutt Martin Fick Martin Fick +Martin Wallgren +Matthias Sohn Maxime Guerreiro Michael Zhou +Monty Taylor Mônica Dionísio monica.dionisio Nasser Grainawi Nasser Grainawi +Orgad Shaneh +Paladox +Patrick Hiesel Peter Jönsson Peter Jönsson Rafael Rabelo Silva rafael.rabelosilva +Réda Housni Alaoui Richard Möhn Sam Saccone Sam Saccone @@ -70,6 +84,7 @@ Shawn Pearce Sixin Li sixin li Sven Selberg Sven Selberg +Thomas Dräbing Tom Wang Tom Tomas Westling thomas.westling Ulrik Sjölin diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index b2c8a35ffc..7379e032c3 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt @@ -1180,18 +1180,6 @@ Allow blame on side by side diff. If set to false, blame cannot be used. + Default is true. -[[change.api.allowedIdentifier]]change.api.allowedIdentifier:: -+ -Change identifier(s) that are allowed on the API. See -link:rest-api-changes.html#change-id[Change Id] for more information. -+ -Possible values are `ALL`, `TRIPLET`, `NUMERIC_ID`, `I_HASH`, and -`COMMIT_HASH` or any combination of those as a string list. -`PROJECT_NUMERIC_ID` is always allowed and doesn't need to be listed -explicitly. -+ -Default is `ALL`. - [[change.cacheAutomerge]]change.cacheAutomerge:: + When reviewing diff commits, the left-hand side shows the output of the diff --git a/Documentation/config-plugins.txt b/Documentation/config-plugins.txt index 36276ef880..272c4eb3f9 100644 --- a/Documentation/config-plugins.txt +++ b/Documentation/config-plugins.txt @@ -175,649 +175,8 @@ Configuration,role=external,window=_blank] [[other-plugins]] == Other Plugins -Besides core plugins there are many other Gerrit plugins available. -These plugins are developed and maintained by different parties. -The Gerrit Project doesn't guarantee proper functionality of any of -these plugins. - -The Gerrit Project doesn't provide binaries for these plugins, but -there is one public service that offers the download of pre-built -plugin jars: - -* link:https://gerrit-ci.gerritforge.com[CI Server from GerritForge,role=external,window=_blank] - -The following list gives an overview of available plugins, but the -list may not be complete. You may discover more plugins on -link:https://gerrit-review.googlesource.com/admin/repos/?filter=plugins%252F[ -gerrit-review,role=external,window=_blank]. - -Note that the documentation and configuration links in the list below are -to the plugins' master branch. Please refer to the appropriate branch for -the Gerrit version you are using. Be aware that in some cases a stable -branch might not exist when the master branch is compatible with multiple -versions, or the plugin might not be compatible at all with your version. - -[[admin-console]] -=== admin-console - -Plugin to provide administrator-only functionality, intended to -simplify common administrative tasks. Currently providing user-level -information. Also providing access control information by project or -project/account. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/admin-console[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/admin-console/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[analytics]] -=== analytics - -Plugin to extract commit and review data from Gerrit projects and -expose aggregated metrics over REST and SSH API. -Metrics are extracted in JSON format with one record per line, ready to be -archived and processed with popular BigData transformation tools such -Apache Spark or published and visualized in dashboards. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/analytics[Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/analytics/+doc/master/README.md[Documentation,role=external,window=_blank] - -[[avatars-external]] -=== avatars-external - -This plugin allows to use an external url to load the avatar images -from. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/avatars-external[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/avatars-external/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/avatars-external/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[avatars-gravatar]] -=== avatars-gravatar - -Plugin to display user icons from Gravatar. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/avatars-gravatar[ -Project,role=external,window=_blank] - -[[branch-network]] -=== branch-network - -This plugin allows the rendering of Git repository branch network in a -graphical HTML5 Canvas. It is mainly intended to be used as a -"project link" in a gitweb configuration. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/branch-network[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/branch-network/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/branch-network/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[changemessage]] -=== changemessage - -This plugin allows to display a static info message on the change screen. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/changemessage[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/changemessage/+doc/master/src/main/resources/Documentation/about.md[ -Plugin Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/changemessage/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[checks]] -=== checks - -The checks plugin provides a REST API and UI extensions for integrating -CI systems with Gerrit. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/checks[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/checks/+doc/master/README.md[ -Plugin Documentation,role=external,window=_blank] - -[[egit]] -=== egit - -This plugin provides extensions for easier usage with EGit. - -The plugin adds a download command for EGit that allows to copy only -the change ref into the clipboard. The change ref is needed for -downloading a Gerrit change from within EGit. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/egit[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/egit/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[emoticons]] -=== emoticons - -This plugin allows users to see emoticons in comments as images. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/emoticons[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/emoticons/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/emoticons/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[find-owners]] -=== find-owners -This plugin provides (1) a change review action button `[FIND OWNERS]` -that shows owners of changed files to be included as code reviewers, and -(2) Prolog predicates to make sure that a CL is submittable -only with owner Code-Review +1 votes. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/find-owners[Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/find-owners/+doc/master/src/main/resources/Documentation/about.md[Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/find-owners/+doc/master/src/main/resources/Documentation/config.md[Configuration,role=external,window=_blank] - -[[gitblit]] -=== gitblit - -GitBlit code-viewer plugin with SSO and Security Access Control. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/gitblit[ -Project,role=external,window=_blank] - -[[github]] -=== github - -Plugin to integrate with GitHub: replication, pull-request to Change-Sets - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/github[ -Project,role=external,window=_blank] - -[[healthcheck]] -=== healthcheck - -Plugin for monitoring and alerting when Gerrit does not behave properrly. - -When Gerrit Server needs to be available 24x7, it is important to know -*beforehand* if something isn't working correctly: this plugin exposes a -REST-API that provides the real-time status of the Gerrit internals and can -be integrated with real-time monitoring systems and paging platforms. - -Healthcheck metrics (latency and subsystem healthiness) are published as -Gerrit internal metrics and can be published to dashboards. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/healthcheck[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/healthcheck/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/healthcheck/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[imagare]] -=== imagare - -The imagare plugin allows Gerrit users to upload and share images. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/imagare[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/imagare/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/imagare/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[importer]] -=== importer - -The importer plugin allows to import projects from one Gerrit server -into another Gerrit server. - -Projects can be imported while both source and target Gerrit server -are online. There is no downtime required. - -The git repository and all changes of the project, including approvals -and review comments, are imported. Historic timestamps are preserved. - -Project imports can be resumed. This means a project team can continue -to work in the source system while the import to the target system is -done. By resuming the import the project in the target system can be -updated with the missing delta. - -The importer plugin can also be used to copy a project within one Gerrit -server, and in combination with the link:#delete-project[delete-project] -plugin it can be used to rename a project. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/importer[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/importer/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[its-plugins]] -=== Issue Tracker System Plugins - -Plugins to integrate with issue tracker systems (ITS), that (based -on events in Gerrit) allows to take actions in the ITS. For example, -they can add comments to bugs, or change status of bugs. - -All its-plugins have a common base implementation which is stored in -the `its-base` project. `its-base` is not a plugin, but just a -framework for the ITS plugins which is packaged within each ITS plugin. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-base[ -its-base Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/its-base/+doc/master/src/main/resources/Documentation/about.md[ -its-base Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/its-base/+doc/master/src/main/resources/Documentation/config.md[ -its-base Configuration,role=external,window=_blank] - -[[its-bugzilla]] -==== its-bugzilla - -Plugin to integrate with Bugzilla. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-bugzilla[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/its-bugzilla/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[its-jira]] -==== its-jira - -Plugin to integrate with Jira. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-jira[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/its-jira/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[its-phabricator]] -==== its-phabricator - -Plugin to integrate with Phabricator. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-phabricator[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/its-phabricator/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[its-rtc]] -==== its-rtc - -Plugin to integrate with IBM Rational Team Concert (RTC). - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-rtc[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/its-rtc/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[its-storyboard]] -==== its-storyboard - -Plugin to integrate with Storyboard task tracking system. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-storyboard[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/its-storyboard/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[javamelody]] -=== javamelody - -This plugin allows to monitor the Gerrit server. - -This plugin integrates JavaMelody in Gerrit in order to retrieve live -instrumentation data from Gerrit. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/javamelody[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/javamelody/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -https://gerrit.googlesource.com/plugins/javamelody/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[labelui]] -=== labelui - -The labelui plugin adds a user preference that allows users to choose a -table control to render the labels/approvals on the change screen -(similar to how labels/approvals were rendered on the old change -screen). - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/labelui[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/labelui/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[menuextender]] -=== menuextender - -The menuextender plugin allows Gerrit administrators to configure -additional menu entries from the WebUI. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/menuextender[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/menuextender/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/menuextender/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[metrics-reporter-elasticsearch]] -=== metrics-reporter-elasticsearch - -This plugin reports Gerrit metrics to Elasticsearch. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/metrics-reporter-elasticsearch[ -Project,role=external,window=_blank]. - -[[metrics-reporter-graphite]] -=== metrics-reporter-graphite - -This plugin reports Gerrit metrics to Graphite. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/metrics-reporter-graphite[ -Project,role=external,window=_blank]. - -[[metrics-reporter-jmx]] -=== metrics-reporter-jmx - -This plugin reports Gerrit metrics to JMX. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/metrics-reporter-jmx[ -Project,role=external,window=_blank]. - -[[metrics-reporter-prometheus]] -=== metrics-reporter-prometheus - -This plugin exposes Gerrit metrics for consumption by Prometheus. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/metrics-reporter-prometheus[ -Project,role=external,window=_blank]. - -[[motd]] -=== motd - -This plugin can output messages to clients when pulling/fetching/cloning -code from Gerrit Code Review. If the client (and transport mechanism) -can support sending the message to the client, it will be displayed to -the user (usually prefixed by “remote: ”), but will be silently -discarded otherwise. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/motd[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/motd/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/motd/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[oauth-authentication-provider]] -=== OAuth authentication provider -This plugin enables Gerrit to use OAuth2 protocol for authentication. -Several OAuth2 providers are supported: - -* AirVantage -* Bitbucket -* CAS -* CoreOS Dex -* Facebook -* GitHub -* GitLab -* Google -* Keycloak -* Office365 - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/oauth[Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/oauth/+doc/master/src/main/resources/Documentation/config.md[Configuration,role=external,window=_blank] - -[[owners]] -=== owners -This plugin provides a Prolog predicate `add_owner_approval/3` that -appends `label('Owner-Approval', need(_))` to a provided list. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/owners[Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/owners/+doc/master/README.md[Documentation,role=external,window=_blank] - -[[project-download-commands]] -=== project-download-commands - -This plugin adds support for project specific download commands. - -Project specific download commands that are defined on a parent project -are inherited by the child projects. Child projects can overwrite the -inherited download command or remove it by assigning no value to it. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/project-download-commands[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/project-download-commands/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/project-download-commands/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[quota]] -=== quota - -This plugin allows to enforce quotas in Gerrit. - -To protect a Gerrit installation it makes sense to limit the resources -that a project or group can consume. To do this a Gerrit administrator -can use this plugin to define quotas on project namespaces. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/quota[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/quota/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] -link:https://gerrit.googlesource.com/plugins/quota/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[rabbitmq]] -=== rabbitmq - -A plugin that publishes Gerrit events to a -link:https://www.rabbitmq.com/[RabbitMQ,role=external,window=_blank] exchange. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/rabbitmq[Project,role=external,window=_blank] -link:https://gerrit.googlesource.com/plugins/rabbitmq/+/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[readonly]] -=== readonly - -A plugin that makes the Gerrit server read-only by rejecting git pushes, -blocking HTTP PUT/POST/DELETE requests, and disabling SSH commands. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/readonly[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/readonly/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/readonly/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[ref-protection]] -=== ref-protection - -A plugin that protects against commits being lost. - -Backups of deleted or non-fast-forward updated refs are created under the -`refs/backups/` namespace. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/ref-protection[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/ref-protection/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[reparent]] -=== reparent - -A plugin that provides project reparenting as a self-service for project owners. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/reparent[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/reparent/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/reparent/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[review-strategy]] -=== review-strategy - -This plugin allows users to configure different review strategies. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/review-strategy[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/review-strategy/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[reviewers]] -=== reviewers - -A plugin that allows adding default reviewers to a change. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/reviewers[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/reviewers/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/reviewers/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[reviewers-by-blame]] -=== reviewers-by-blame - -A plugin that allows automatically adding reviewers to a change from -the git blame computation on the changed files. It will add the users -that authored most of the lines touched by the change, since these -users should be familiar with the code and can mostly review the -change. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/reviewers-by-blame[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/reviewers-by-blame/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/reviewers-by-blame/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[groovy-provider]] -=== scripting/groovy-provider - -This plugin provides a Groovy runtime environment for Gerrit plugins in Groovy. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/scripting/groovy-provider[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/scripting/groovy-provider/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[saml-authentication-provider]] -=== SAML2 authentication provider - -This plugin enables Gerrit to use SAML2 protocol for authentication. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/saml[Project,role=external,window=_blank] - -[[scala-provider]] -=== scripting/scala-provider - -This plugin provides a Scala runtime environment for Gerrit plugins in Scala. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/scripting/scala-provider[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/scripting/scala-provider/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] - -[[scripts]] -=== scripts - -Repository containing a collection of Gerrit scripting plugins that are intended -to provide simple and useful extensions. - -Groovy and Scala scripts require the installation of the corresponding -scripting/*-provider plugin in order to be loaded into Gerrit. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/scripts[Project,role=external,window=_blank] -link:https://gerrit.googlesource.com/plugins/scripts/+doc/master/README.md[Documentation,role=external,window=_blank] - -[[server-config]] -=== server-config - -This plugin enables access (download and upload) to the server config -files. It may be used to change Gerrit config files (like -`etc/gerrit.config`) in cases where direct access to the file system -where Gerrit's config files are stored is difficult or impossible to -get. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/server-config[ -Project,role=external,window=_blank] - -[[serviceuser]] -=== serviceuser - -This plugin allows to create service users in Gerrit. - -A service user is a user that is used by another service to communicate -with Gerrit. E.g. a service user is needed to run the Gerrit Trigger -Plugin in Jenkins. A service user is not able to login into the Gerrit -WebUI and it cannot push commits or tags. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/serviceuser[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/serviceuser/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/serviceuser/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[uploadvalidator]] -=== uploadvalidator - -This plugin allows to configure upload validations per project. - -Project owners can configure blocked file extensions, required footers -and a maximum allowed path length. Pushes of commits that violate these -settings are rejected by Gerrit. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/uploadvalidator[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/uploadvalidator/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/uploadvalidator/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[verify-status]] -=== verify-status - -This plugin adds a separate channel for Gerrit to store test metadata and -view them on the Gerrit UI. The metadata can be stored in the Gerrit database -or in a completely separate datastore. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/verify-status[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/verify-status/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/verify-status/+doc/master/src/main/resources/Documentation/database.md[ -Configuration,role=external,window=_blank] - -[[websession-flatfile]] -=== websession-flatfile - -This plugin replaces the built-in Gerrit H2 based websession cache with -a flatfile based implementation. This implementation is shareable -among multiple Gerrit servers, making it useful for cluster -Gerrit installations having multiple primary Gerrit nodes. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/websession-flatfile[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/websession-flatfile/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/websession-flatfile/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - -[[x-docs]] -=== x-docs - -This plugin serves project documentation as HTML pages. - -link:https://gerrit-review.googlesource.com/admin/repos/plugins/x-docs[ -Project,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/x-docs/+doc/master/src/main/resources/Documentation/about.md[ -Documentation,role=external,window=_blank] | -link:https://gerrit.googlesource.com/plugins/x-docs/+doc/master/src/main/resources/Documentation/config.md[ -Configuration,role=external,window=_blank] - +Besides core plugins there are many other Gerrit plugins available. This Gerrit home +link:https://www.gerritcodereview.com/plugins.html[page for plugins] lists them. GERRIT ------ diff --git a/Documentation/pgm-reindex.txt b/Documentation/pgm-reindex.txt index e13d518fc0..5167277b8e 100644 --- a/Documentation/pgm-reindex.txt +++ b/Documentation/pgm-reindex.txt @@ -7,6 +7,7 @@ reindex - Rebuild the secondary index [verse] -- _java_ -jar gerrit.war _reindex_ + -d [--threads] [--changes-schema-version] [--verbose] diff --git a/Documentation/replace_macros.py b/Documentation/replace_macros.py index 7d8ea235cb..aaa9223bf0 100755 --- a/Documentation/replace_macros.py +++ b/Documentation/replace_macros.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from optparse import OptionParser +import argparse import re import sys @@ -239,34 +239,34 @@ LINK_SCRIPT = """ """ -opts = OptionParser() -opts.add_option('-o', '--out', help='output file') -opts.add_option('-s', '--src', help='source file') -opts.add_option('-x', '--suffix', help='suffix for included filenames') -opts.add_option('-b', '--searchbox', action="store_true", default=True, +parser = argparse.ArgumentParser() +parser.add_argument('-o', '--out', help='output file') +parser.add_argument('-s', '--src', help='source file') +parser.add_argument('-x', '--suffix', help='suffix for included filenames') +parser.add_argument('-b', '--searchbox', action="store_true", default=True, help="generate the search boxes") -opts.add_option('--no-searchbox', action="store_false", dest='searchbox', +parser.add_argument('--no-searchbox', action="store_false", dest='searchbox', help="don't generate the search boxes") -opts.add_option('--site-search', action="store", metavar="SITE", +parser.add_argument('--site-search', action="store", metavar="SITE", help=("generate the search box using google. SITE should " + "point to the domain/path of the site, eg. " + "gerrit-review.googlesource.com/Documentation")) -options, _ = opts.parse_args() +args = parser.parse_args() -if options.site_search: +if args.site_search: SEARCH_BOX = (SEARCH_BOX % - GOOGLE_SITE_SEARCH.replace("@SITE@", options.site_search)) + GOOGLE_SITE_SEARCH.replace("@SITE@", args.site_search)) else: SEARCH_BOX = SEARCH_BOX % BUILTIN_SEARCH try: try: - out_file = open(options.out, 'w', errors='ignore') - src_file = open(options.src, 'r', errors='ignore') + out_file = open(args.out, 'w', errors='ignore') + src_file = open(args.src, 'r', errors='ignore') except TypeError: - out_file = open(options.out, 'w') - src_file = open(options.src, 'r') + out_file = open(args.out, 'w') + src_file = open(args.src, 'r') last_line = '' ignore_next_line = False last_title = '' @@ -277,14 +277,14 @@ try: last_line = '' elif PAT_SEARCHBOX.match(last_line): # Case of 'SEARCHBOX\n---------' - if options.searchbox: + if args.searchbox: out_file.write(SEARCH_BOX) last_line = '' elif PAT_INCLUDE.match(line): # Case of 'include::' match = PAT_INCLUDE.match(line) out_file.write(last_line) - last_line = match.group(1) + options.suffix + match.group(2) + '\n' + last_line = match.group(1) + args.suffix + match.group(2) + '\n' elif PAT_STARS.match(line): if PAT_TITLE.match(last_line): # Case of the title in '.\n****\nget::<url>\n****' @@ -310,5 +310,5 @@ try: out_file.close() except IOError as err: sys.stderr.write( - "error while expanding %s to %s: %s" % (options.src, options.out, err)) + "error while expanding %s to %s: %s" % (args.src, args.out, err)) exit(1) diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt index 59af6943ec..143470bb32 100644 --- a/Documentation/rest-api-changes.txt +++ b/Documentation/rest-api-changes.txt @@ -5668,8 +5668,7 @@ In this case, use a POST request instead: Identifier that uniquely identifies one change. It contains the URL-encoded project name as well as the change number: "'$$<project>~<numericId>$$'" -Depending on the server's configuration, Gerrit can still support the following -deprecated identifiers. These will be removed in a future release: +Gerrit also supports the following identifiers: * an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'", where for the branch the `refs/heads/` prefix can be omitted @@ -5678,10 +5677,6 @@ deprecated identifiers. These will be removed in a future release: ("I8473b95934b5732ac55d26311a706c9c2bde9940") * a numeric change ID ("4247") -If you need more time to migrate off of old change IDs, please see -link:config-gerrit.html#change.api.allowedIdentifier[change.api.allowedIdentifier] -for more information on how to enable the use of deprecated identifiers. - [[change-message-id]] === \{change-message-id\} ID of a change message returned in a link:#change-message-info[ChangeMessageInfo]. diff --git a/contrib/populate-fixture-data.py b/contrib/populate-fixture-data.py index 22e0c1b71e..4c6769cf3e 100755 --- a/contrib/populate-fixture-data.py +++ b/contrib/populate-fixture-data.py @@ -22,9 +22,9 @@ TODO(hiesel): Add comments """ from __future__ import print_function +import argparse import atexit import json -import optparse import os import random import shutil @@ -275,22 +275,22 @@ def clean_up(): def main(): - p = optparse.OptionParser() - p.add_option("-u", "--user_count", action="store", + p = argparse.ArgumentParser() + p.add_argument("-u", "--user_count", action="store", default=100, - type='int', + type=int, help="number of users to generate") - p.add_option("-p", "--port", action="store", + p.add_argument("-p", "--port", action="store", default=8080, - type='int', + type=int, help="port of server") - (options, _) = p.parse_args() + args = p.parse_args() global BASE_URL - BASE_URL = BASE_URL % options.port + BASE_URL = BASE_URL % args.port print(BASE_URL) set_up() - gerrit_users = get_random_users(options.user_count) + gerrit_users = get_random_users(args.user_count) group_names = create_gerrit_groups() for idx, u in enumerate(gerrit_users): diff --git a/java/com/google/gerrit/extensions/restapi/DeprecatedIdentifierException.java b/java/com/google/gerrit/extensions/restapi/DeprecatedIdentifierException.java deleted file mode 100644 index aa28cfc789..0000000000 --- a/java/com/google/gerrit/extensions/restapi/DeprecatedIdentifierException.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2017 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.gerrit.extensions.restapi; - -/** Named resource was accessed using a deprecated identifier. */ -public class DeprecatedIdentifierException extends BadRequestException { - private static final long serialVersionUID = 1L; - - /** Requested resource using a deprecated identifier. */ - public DeprecatedIdentifierException(String msg) { - super(msg); - } -} diff --git a/java/com/google/gerrit/metrics/proc/JGitMetricModule.java b/java/com/google/gerrit/metrics/proc/JGitMetricModule.java index 62b24972b3..ec24355954 100644 --- a/java/com/google/gerrit/metrics/proc/JGitMetricModule.java +++ b/java/com/google/gerrit/metrics/proc/JGitMetricModule.java @@ -14,6 +14,7 @@ package com.google.gerrit.metrics.proc; +import com.google.common.base.Supplier; import com.google.gerrit.metrics.CallbackMetric1; import com.google.gerrit.metrics.Description; import com.google.gerrit.metrics.Description.Units; @@ -34,13 +35,23 @@ public class JGitMetricModule extends MetricModule { new Description("Bytes of memory retained in JGit block cache.") .setGauge() .setUnit(Units.BYTES), - WindowCacheStats.getStats()::getOpenByteCount); + new Supplier<Long>() { + @Override + public Long get() { + return WindowCacheStats.getStats().getOpenByteCount(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/open_files", Long.class, new Description("File handles held open by JGit block cache.").setGauge().setUnit("fds"), - WindowCacheStats.getStats()::getOpenFileCount); + new Supplier<Long>() { + @Override + public Long get() { + return WindowCacheStats.getStats().getOpenFileCount(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/avg_load_time", @@ -48,61 +59,110 @@ public class JGitMetricModule extends MetricModule { new Description("Average time to load a cache entry for JGit block cache.") .setGauge() .setUnit(Units.NANOSECONDS), - WindowCacheStats.getStats()::getAverageLoadTime); + new Supplier<Double>() { + @Override + public Double get() { + return WindowCacheStats.getStats().getAverageLoadTime(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/eviction_count", Long.class, new Description("Cache evictions for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getEvictionCount); + new Supplier<Long>() { + @Override + public Long get() { + return WindowCacheStats.getStats().getEvictionCount(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/eviction_ratio", Double.class, new Description("Cache eviction ratio for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getEvictionRatio); + new Supplier<Double>() { + @Override + public Double get() { + return WindowCacheStats.getStats().getEvictionRatio(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/hit_count", Long.class, new Description("Cache hits for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getHitCount); + new Supplier<Long>() { + @Override + public Long get() { + return WindowCacheStats.getStats().getHitCount(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/hit_ratio", Double.class, new Description("Cache hit ratio for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getHitRatio); + new Supplier<Double>() { + @Override + public Double get() { + return WindowCacheStats.getStats().getHitRatio(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/load_failure_count", Long.class, new Description("Failed cache loads for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getLoadFailureCount); + new Supplier<Long>() { + @Override + public Long get() { + return WindowCacheStats.getStats().getLoadFailureCount(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/load_failure_ratio", Double.class, new Description("Failed cache load ratio for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getLoadFailureRatio); + new Supplier<Double>() { + @Override + public Double get() { + return WindowCacheStats.getStats().getLoadFailureRatio(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/load_success_count", Long.class, new Description("Successfull cache loads for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getLoadSuccessCount); - + new Supplier<Long>() { + @Override + public Long get() { + return WindowCacheStats.getStats().getLoadSuccessCount(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/miss_count", Long.class, new Description("Cache misses for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getMissCount); + new Supplier<Long>() { + @Override + public Long get() { + return WindowCacheStats.getStats().getMissCount(); + } + }); metrics.newCallbackMetric( "jgit/block_cache/miss_ratio", Double.class, new Description("Cache miss ratio for JGit block cache.").setGauge(), - WindowCacheStats.getStats()::getMissRatio); + new Supplier<Double>() { + @Override + public Double get() { + return WindowCacheStats.getStats().getMissRatio(); + } + }); CallbackMetric1<String, Long> repoEnt = metrics.newCallbackMetric( diff --git a/java/com/google/gerrit/server/change/ChangeFinder.java b/java/com/google/gerrit/server/change/ChangeFinder.java index f2b6dd6b21..71d7ba01e8 100644 --- a/java/com/google/gerrit/server/change/ChangeFinder.java +++ b/java/com/google/gerrit/server/change/ChangeFinder.java @@ -17,14 +17,12 @@ package com.google.gerrit.server.change; import com.google.common.base.Throwables; import com.google.common.cache.Cache; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.google.common.flogger.FluentLogger; import com.google.common.primitives.Ints; import com.google.gerrit.entities.Change; import com.google.gerrit.entities.Project; import com.google.gerrit.exceptions.StorageException; -import com.google.gerrit.extensions.restapi.DeprecatedIdentifierException; import com.google.gerrit.extensions.restapi.Url; import com.google.gerrit.git.ObjectIds; import com.google.gerrit.index.IndexConfig; @@ -33,8 +31,6 @@ import com.google.gerrit.metrics.Description; import com.google.gerrit.metrics.Field; import com.google.gerrit.metrics.MetricMaker; import com.google.gerrit.server.cache.CacheModule; -import com.google.gerrit.server.config.ConfigUtil; -import com.google.gerrit.server.config.GerritServerConfig; import com.google.gerrit.server.logging.Metadata; import com.google.gerrit.server.notedb.ChangeNotes; import com.google.gerrit.server.project.NoSuchChangeException; @@ -51,7 +47,6 @@ import java.util.List; import java.util.Optional; import java.util.Set; import org.eclipse.jgit.errors.RepositoryNotFoundException; -import org.eclipse.jgit.lib.Config; @Singleton public class ChangeFinder { @@ -82,7 +77,6 @@ public class ChangeFinder { private final Provider<InternalChangeQuery> queryProvider; private final ChangeNotes.Factory changeNotesFactory; private final Counter1<ChangeIdType> changeIdCounter; - private final ImmutableSet<ChangeIdType> allowedIdTypes; @Inject ChangeFinder( @@ -90,8 +84,7 @@ public class ChangeFinder { @Named(CACHE_NAME) Cache<Change.Id, String> changeIdProjectCache, Provider<InternalChangeQuery> queryProvider, ChangeNotes.Factory changeNotesFactory, - MetricMaker metricMaker, - @GerritServerConfig Config config) { + MetricMaker metricMaker) { this.indexConfig = indexConfig; this.changeIdProjectCache = changeIdProjectCache; this.queryProvider = queryProvider; @@ -104,11 +97,6 @@ public class ChangeFinder { .setUnit("requests"), Field.ofEnum(ChangeIdType.class, "change_id_type", Metadata.Builder::changeIdType) .build()); - List<ChangeIdType> configuredChangeIdTypes = - ConfigUtil.getEnumList(config, "change", "api", "allowedIdentifier", ChangeIdType.ALL); - // Ensure that PROJECT_NUMERIC_ID can't be removed - configuredChangeIdTypes.add(ChangeIdType.PROJECT_NUMERIC_ID); - this.allowedIdTypes = ImmutableSet.copyOf(configuredChangeIdTypes); } public Optional<ChangeNotes> findOne(String id) { @@ -126,25 +114,6 @@ public class ChangeFinder { * @return possibly-empty list of notes for all matching changes; may or may not be visible. */ public List<ChangeNotes> find(String id) { - try { - return find(id, false); - } catch (DeprecatedIdentifierException e) { - // This can't happen because we don't enforce deprecation - throw new StorageException(e); - } - } - - /** - * Find changes matching the given identifier. - * - * @param id change identifier. - * @param enforceDeprecation boolean to see if we should throw {@link - * DeprecatedIdentifierException} in case the identifier is deprecated - * @return possibly-empty list of notes for all matching changes; may or may not be visible. - * @throws DeprecatedIdentifierException if the identifier is deprecated. - */ - public List<ChangeNotes> find(String id, boolean enforceDeprecation) - throws DeprecatedIdentifierException { if (id.isEmpty()) { return Collections.emptyList(); } @@ -155,7 +124,7 @@ public class ChangeFinder { // Try project~numericChangeId Integer n = Ints.tryParse(id.substring(z + 1)); if (n != null) { - checkIdType(ChangeIdType.PROJECT_NUMERIC_ID, enforceDeprecation, n.toString()); + changeIdCounter.increment(ChangeIdType.PROJECT_NUMERIC_ID); return fromProjectNumber(id.substring(0, z), n.intValue()); } } @@ -164,7 +133,7 @@ public class ChangeFinder { // Try numeric changeId Integer n = Ints.tryParse(id); if (n != null) { - checkIdType(ChangeIdType.NUMERIC_ID, enforceDeprecation, n.toString()); + changeIdCounter.increment(ChangeIdType.NUMERIC_ID); return find(Change.id(n)); } } @@ -175,7 +144,7 @@ public class ChangeFinder { // Try commit hash if (id.matches("^([0-9a-fA-F]{" + ObjectIds.ABBREV_STR_LEN + "," + ObjectIds.STR_LEN + "})$")) { - checkIdType(ChangeIdType.COMMIT_HASH, enforceDeprecation, id); + changeIdCounter.increment(ChangeIdType.COMMIT_HASH); return asChangeNotes(query.byCommit(id)); } @@ -184,7 +153,7 @@ public class ChangeFinder { Optional<ChangeTriplet> triplet = ChangeTriplet.parse(id, y, z); if (triplet.isPresent()) { ChangeTriplet t = triplet.get(); - checkIdType(ChangeIdType.TRIPLET, enforceDeprecation, triplet.get().toString()); + changeIdCounter.increment(ChangeIdType.TRIPLET); return asChangeNotes(query.byBranchKey(t.branch(), t.id())); } } @@ -192,7 +161,7 @@ public class ChangeFinder { // Try isolated Ihash... format ("Change-Id: Ihash"). List<ChangeNotes> notes = asChangeNotes(query.byKeyPrefix(id)); if (!notes.isEmpty()) { - checkIdType(ChangeIdType.I_HASH, enforceDeprecation, id); + changeIdCounter.increment(ChangeIdType.I_HASH); } return notes; } @@ -269,18 +238,4 @@ public class ChangeFinder { } return notes; } - - private void checkIdType(ChangeIdType type, boolean enforceDeprecation, String val) - throws DeprecatedIdentifierException { - if (enforceDeprecation - && !allowedIdTypes.contains(ChangeIdType.ALL) - && !allowedIdTypes.contains(type)) { - throw new DeprecatedIdentifierException( - String.format( - "The provided change identifier %s is deprecated. " - + "Use 'project~changeNumber' instead.", - val)); - } - changeIdCounter.increment(type); - } } diff --git a/java/com/google/gerrit/server/config/UrlFormatter.java b/java/com/google/gerrit/server/config/UrlFormatter.java index 15d47c3ffa..6b2510e480 100644 --- a/java/com/google/gerrit/server/config/UrlFormatter.java +++ b/java/com/google/gerrit/server/config/UrlFormatter.java @@ -60,7 +60,7 @@ public interface UrlFormatter { .map(url -> url + String.format("@%s%d", side == 0 ? "a" : "", startLine)); } - /** Returns a URL pointing to a section of the settings page. */ + /** Returns a URL pointing to the settings page. */ default Optional<String> getSettingsUrl() { return getWebUrl().map(url -> url + "settings"); } diff --git a/java/com/google/gerrit/server/git/receive/ReceiveCommits.java b/java/com/google/gerrit/server/git/receive/ReceiveCommits.java index 1b67965703..4263b3b552 100644 --- a/java/com/google/gerrit/server/git/receive/ReceiveCommits.java +++ b/java/com/google/gerrit/server/git/receive/ReceiveCommits.java @@ -245,6 +245,7 @@ class ReceiveCommits { private static final String CANNOT_DELETE_CHANGES = "Cannot delete from '" + REFS_CHANGES + "'"; private static final String CANNOT_DELETE_CONFIG = "Cannot delete project configuration from '" + RefNames.REFS_CONFIG + "'"; + private static final String INTERNAL_SERVER_ERROR = "internal server error"; interface Factory { ReceiveCommits create( @@ -590,7 +591,7 @@ class ReceiveCommits { commands = commands.stream().map(c -> wrapReceiveCommand(c, commandProgress)).collect(toList()); processCommandsUnsafe(commands, progress); - rejectRemaining(commands, "internal server error"); + rejectRemaining(commands, INTERNAL_SERVER_ERROR); // This sends error messages before the 'done' string of the progress monitor is sent. // Currently, the test framework relies on this ordering to understand if pushes completed @@ -726,7 +727,7 @@ class ReceiveCommits { logger.atFine().log("Added %d additional ref updates", added); bu.execute(); } catch (UpdateException | RestApiException e) { - rejectRemaining(cmds, "internal server error"); + rejectRemaining(cmds, INTERNAL_SERVER_ERROR); logger.atFine().withCause(e).log("update failed:"); } @@ -967,7 +968,7 @@ class ReceiveCommits { } catch (RestApiException | IOException e) { logger.atSevere().withCause(e).log( "Can't insert change/patch set for %s", project.getName()); - reject(magicBranchCmd, "internal server error: " + e.getMessage()); + reject(magicBranchCmd, String.format("%s: %s", INTERNAL_SERVER_ERROR, e.getMessage())); } if (magicBranch != null && magicBranch.submit) { @@ -1892,7 +1893,7 @@ class ReceiveCommits { } catch (IOException e) { logger.atWarning().withCause(e).log( "Project %s cannot read %s", project.getName(), id.name()); - reject(cmd, "internal server error"); + reject(cmd, INTERNAL_SERVER_ERROR); return; } } @@ -1919,7 +1920,7 @@ class ReceiveCommits { } catch (IOException ex) { logger.atWarning().withCause(ex).log( "Error walking to %s in project %s", destBranch, project.getName()); - reject(cmd, "internal server error"); + reject(cmd, INTERNAL_SERVER_ERROR); return; } @@ -2328,7 +2329,7 @@ class ReceiveCommits { logger.atFine().log("Finished updating groups from GroupCollector"); } catch (StorageException e) { logger.atSevere().withCause(e).log("Error collecting groups for changes"); - reject(magicBranch.cmd, "internal server error"); + reject(magicBranch.cmd, INTERNAL_SERVER_ERROR); } return newChanges; } @@ -2653,11 +2654,11 @@ class ReceiveCommits { } catch (StorageException err) { logger.atSevere().withCause(err).log( "Cannot read database before replacement for project %s", project.getName()); - rejectRemainingRequests(replaceByChange.values(), "internal server error"); + rejectRemainingRequests(replaceByChange.values(), INTERNAL_SERVER_ERROR); } catch (IOException | PermissionBackendException err) { logger.atSevere().withCause(err).log( "Cannot read repository before replacement for project %s", project.getName()); - rejectRemainingRequests(replaceByChange.values(), "internal server error"); + rejectRemainingRequests(replaceByChange.values(), INTERNAL_SERVER_ERROR); } logger.atFine().log("Read %d changes to replace", replaceByChange.size()); diff --git a/java/com/google/gerrit/server/restapi/change/ChangesCollection.java b/java/com/google/gerrit/server/restapi/change/ChangesCollection.java index cbf9086f19..3b0321d5f1 100644 --- a/java/com/google/gerrit/server/restapi/change/ChangesCollection.java +++ b/java/com/google/gerrit/server/restapi/change/ChangesCollection.java @@ -81,7 +81,7 @@ public class ChangesCollection implements RestCollection<TopLevelResource, Chang @Override public ChangeResource parse(TopLevelResource root, IdString id) throws RestApiException, PermissionBackendException, IOException { - List<ChangeNotes> notes = changeFinder.find(id.encoded(), true); + List<ChangeNotes> notes = changeFinder.find(id.encoded()); if (notes.isEmpty()) { throw new ResourceNotFoundException(id); } else if (notes.size() != 1) { diff --git a/javatests/com/google/gerrit/acceptance/api/change/ChangeIdIT.java b/javatests/com/google/gerrit/acceptance/api/change/ChangeIdIT.java index a0a88f8e16..de73c00f82 100644 --- a/javatests/com/google/gerrit/acceptance/api/change/ChangeIdIT.java +++ b/javatests/com/google/gerrit/acceptance/api/change/ChangeIdIT.java @@ -19,13 +19,11 @@ import static com.google.gerrit.testing.GerritJUnit.assertThrows; import com.google.gerrit.acceptance.AbstractDaemonTest; import com.google.gerrit.acceptance.NoHttpd; -import com.google.gerrit.acceptance.config.GerritConfig; import com.google.gerrit.acceptance.testsuite.project.ProjectOperations; import com.google.gerrit.entities.Project; import com.google.gerrit.extensions.api.changes.ChangeApi; import com.google.gerrit.extensions.common.ChangeInfo; import com.google.gerrit.extensions.common.ChangeInput; -import com.google.gerrit.extensions.restapi.DeprecatedIdentifierException; import com.google.gerrit.extensions.restapi.ResourceNotFoundException; import com.google.inject.Inject; import org.junit.Before; @@ -140,28 +138,4 @@ public class ChangeIdIT extends AbstractDaemonTest { public void wrongChangeIdReturnsNotFound() throws Exception { assertThrows(ResourceNotFoundException.class, () -> gApi.changes().id("I1234567890")); } - - @Test - @GerritConfig( - name = "change.api.allowedIdentifier", - values = {"PROJECT_NUMERIC_ID", "NUMERIC_ID"}) - public void deprecatedChangeIdReturnsBadRequest() throws Exception { - // project~changeNumber still works - ChangeApi cApi1 = gApi.changes().id(project.get(), changeInfo._number); - assertThat(cApi1.get().changeId).isEqualTo(changeInfo.changeId); - // Change number still works - ChangeApi cApi2 = gApi.changes().id(changeInfo._number); - assertThat(cApi2.get().changeId).isEqualTo(changeInfo.changeId); - // IHash throws - ChangeInfo ci = - gApi.changes().create(new ChangeInput(project.get(), "master", "different message")).get(); - DeprecatedIdentifierException thrown = - assertThrows(DeprecatedIdentifierException.class, () -> gApi.changes().id(ci.changeId)); - assertThat(thrown) - .hasMessageThat() - .contains( - "The provided change identifier " - + ci.changeId - + " is deprecated. Use 'project~changeNumber' instead."); - } } diff --git a/javatests/com/google/gerrit/elasticsearch/BUILD b/javatests/com/google/gerrit/elasticsearch/BUILD index 65211662eb..9783f527f5 100644 --- a/javatests/com/google/gerrit/elasticsearch/BUILD +++ b/javatests/com/google/gerrit/elasticsearch/BUILD @@ -17,6 +17,7 @@ java_library( "//lib:junit", "//lib/guice", "//lib/httpcomponents:httpcore", + "//lib/log:api", "//lib/testcontainers", "//lib/testcontainers:testcontainers-elasticsearch", ], diff --git a/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java b/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java index 77c50efde5..98d723f7db 100644 --- a/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java +++ b/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java @@ -16,6 +16,8 @@ package com.google.gerrit.elasticsearch; import org.apache.http.HttpHost; import org.junit.AssumptionViolatedException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testcontainers.elasticsearch.ElasticsearchContainer; /* Helper class for running ES integration tests in docker container */ @@ -74,6 +76,11 @@ public class ElasticContainer extends ElasticsearchContainer { super(getImageName(version)); } + @Override + protected Logger logger() { + return LoggerFactory.getLogger("org.testcontainers"); + } + public HttpHost getHttpHost() { return new HttpHost(getContainerIpAddress(), getMappedPort(ELASTICSEARCH_DEFAULT_PORT)); } diff --git a/lib/log/BUILD b/lib/log/BUILD index e768d9a2f7..fa5bc45beb 100644 --- a/lib/log/BUILD +++ b/lib/log/BUILD @@ -4,6 +4,7 @@ java_library( name = "api", data = ["//lib:LICENSE-slf4j"], visibility = [ + "//javatests/com/google/gerrit/elasticsearch:__pkg__", "//lib:__pkg__", "//plugins:__pkg__", ], diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html index 6a9d9036a9..d9d515f11e 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html @@ -824,15 +824,6 @@ limitations under the License. element.render(keyLocations, prefs).then(done); }); - test('renderSection', () => { - let section = outputEl.querySelector('stub:nth-of-type(2)'); - const prevInnerHTML = section.innerHTML; - section.innerHTML = 'wiped'; - element._builder.renderSection(section); - section = outputEl.querySelector('stub:nth-of-type(2)'); - assert.equal(section.innerHTML, prevInnerHTML); - }); - test('addColumns is called', done => { element.render(keyLocations, {}).then(done); assert.isTrue(element._builder.addColumns.called); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js index 8ce5c7acee..c99b59a239 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js @@ -115,18 +115,6 @@ group.element = element; }; - GrDiffBuilder.prototype.renderSection = function(element) { - for (let i = 0; i < this.groups.length; i++) { - const group = this.groups[i]; - if (group.element === element) { - const newElement = this.buildSectionElement(group); - group.element.parentElement.replaceChild(newElement, group.element); - group.element = newElement; - break; - } - } - }; - GrDiffBuilder.prototype.getGroupsByLineRange = function( startLine, endLine, opt_side) { const groups = []; diff --git a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js index cdd0c7d272..dcda64d0a7 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js @@ -181,7 +181,7 @@ } // If we are done, resolve the promise. if (state.chunkIndex >= chunks.length) { - resolve(this.groups); + resolve(); this._nextStepHandle = null; return; } diff --git a/tools/download_file.py b/tools/download_file.py index d0fe96d36c..f86fd3e034 100755 --- a/tools/download_file.py +++ b/tools/download_file.py @@ -15,8 +15,8 @@ from __future__ import print_function +import argparse from hashlib import sha1 -from optparse import OptionParser from os import link, makedirs, path, remove import shutil from subprocess import check_call, CalledProcessError @@ -75,13 +75,13 @@ def cache_entry(args): return path.join(CACHE_DIR, name) -opts = OptionParser() -opts.add_option('-o', help='local output file') -opts.add_option('-u', help='URL to download') -opts.add_option('-v', help='expected content SHA-1') -opts.add_option('-x', action='append', help='file to delete from ZIP') -opts.add_option('--exclude_java_sources', action='store_true') -args, _ = opts.parse_args() +parser = argparse.ArgumentParser() +parser.add_argument('-o', help='local output file') +parser.add_argument('-u', help='URL to download') +parser.add_argument('-v', help='expected content SHA-1') +parser.add_argument('-x', action='append', help='file to delete from ZIP') +parser.add_argument('--exclude_java_sources', action='store_true') +args = parser.parse_args() root_dir = args.o while root_dir and path.dirname(root_dir) != root_dir: diff --git a/tools/js/download_bower.py b/tools/js/download_bower.py index c1d7d00ce2..1df4b826bc 100755 --- a/tools/js/download_bower.py +++ b/tools/js/download_bower.py @@ -15,9 +15,9 @@ from __future__ import print_function +import argparse import hashlib import json -import optparse import os import shutil import subprocess @@ -80,44 +80,44 @@ def cache_entry(name, package, version, sha1): return os.path.join(CACHE_DIR, '%s-%s.zip-%s' % (name, version, sha1)) -def main(args): - opts = optparse.OptionParser() - opts.add_option('-n', help='short name of component') - opts.add_option('-b', help='bower command') - opts.add_option('-p', help='full package name of component') - opts.add_option('-v', help='version number') - opts.add_option('-s', help='expected content sha1') - opts.add_option('-o', help='output file location') - opts, args_ = opts.parse_args(args) +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('-n', help='short name of component') + parser.add_argument('-b', help='bower command') + parser.add_argument('-p', help='full package name of component') + parser.add_argument('-v', help='version number') + parser.add_argument('-s', help='expected content sha1') + parser.add_argument('-o', help='output file location') + args = parser.parse_args() - assert opts.p - assert opts.v - assert opts.n + assert args.p + assert args.v + assert args.n cwd = os.getcwd() - outzip = os.path.join(cwd, opts.o) - cached = cache_entry(opts.n, opts.p, opts.v, opts.s) + outzip = os.path.join(cwd, args.o) + cached = cache_entry(args.n, args.p, args.v, args.s) if not os.path.exists(cached): - info = bower_info(opts.b, opts.n, opts.p, opts.v) + info = bower_info(args.b, args.n, args.p, args.v) ignore_deps(info) subprocess.check_call( bower_cmd( - opts.b, '--quiet', 'install', '%s#%s' % (opts.p, opts.v))) + args.b, '--quiet', 'install', '%s#%s' % (args.p, args.v))) bc = os.path.join(cwd, 'bower_components') subprocess.check_call( - ['zip', '-q', '--exclude', '.bower.json', '-r', cached, opts.n], + ['zip', '-q', '--exclude', '.bower.json', '-r', cached, args.n], cwd=bc) - if opts.s: - path = os.path.join(bc, opts.n) + if args.s: + path = os.path.join(bc, args.n) sha1 = bowerutil.hash_bower_component( hashlib.sha1(), path).hexdigest() - if opts.s != sha1: + if args.s != sha1: print(( '%s#%s:\n' 'expected %s\n' - 'received %s\n') % (opts.p, opts.v, opts.s, sha1), + 'received %s\n') % (args.p, args.v, args.s, sha1), file=sys.stderr) try: os.remove(cached) @@ -132,4 +132,4 @@ def main(args): if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) + sys.exit(main()) diff --git a/tools/maven/mvn.py b/tools/maven/mvn.py index 59a5efbb80..60e9f15608 100755 --- a/tools/maven/mvn.py +++ b/tools/maven/mvn.py @@ -14,20 +14,20 @@ # limitations under the License. from __future__ import print_function -from optparse import OptionParser +import argparse from os import path, environ from subprocess import check_output, CalledProcessError from sys import stderr -opts = OptionParser() -opts.add_option('--repository', help='maven repository id') -opts.add_option('--url', help='maven repository url') -opts.add_option('-o') -opts.add_option('-a', help='action (valid actions are: install,deploy)') -opts.add_option('-v', help='gerrit version') -opts.add_option('-s', action='append', help='triplet of artifactId:type:path') +parser = argparse.ArgumentParser() +parser.add_argument('--repository', help='maven repository id') +parser.add_argument('--url', help='maven repository url') +parser.add_argument('-o') +parser.add_argument('-a', help='action (valid actions are: install,deploy)') +parser.add_argument('-v', help='gerrit version') +parser.add_argument('-s', action='append', help='triplet of artifactId:type:path') +args = parser.parse_args() -args, ctx = opts.parse_args() if not args.v: print('version is empty', file=stderr) exit(1) diff --git a/tools/version.py b/tools/version.py index bb3b56034a..2326757a05 100755 --- a/tools/version.py +++ b/tools/version.py @@ -14,21 +14,16 @@ # limitations under the License. from __future__ import print_function -from optparse import OptionParser +import argparse import os.path import re import sys -parser = OptionParser() -opts, args = parser.parse_args() - -if not len(args): - parser.error('not enough arguments') -elif len(args) > 1: - parser.error('too many arguments') - -DEST_PATTERN = r'\g<1>%s\g<3>' % args[0] +parser = argparse.ArgumentParser() +parser.add_argument('version') +args = parser.parse_args() +DEST_PATTERN = r'\g<1>%s\g<3>' % args.version def replace_in_file(filename, src_pattern): try: