Merge branch 'stable-3.2' into stable-3.3
* stable-3.2:
dev-plugins: Fix code examples and header levels
Update git submodules
Update git submodules
user-search.txt: Fix bullet list formatting
Set version to 3.1.17-SNAPSHOT
Set version to 3.2.13-SNAPSHOT
Set version to 3.2.12
Set version to 3.1.16
Fix disabling of plugin project config option in UI
Change-Id: I63a9c5dab272705f9dd95d4f322836e219856164
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index a68c38b..383f5c0 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -74,9 +74,9 @@
manifest fields:
----
- Implementation-Title: Example plugin showing examples
- Implementation-Version: 1.0
- Implementation-Vendor: Example, Inc.
+Implementation-Title: Example plugin showing examples
+Implementation-Version: 1.0
+Implementation-Vendor: Example, Inc.
----
=== ApiType
@@ -88,7 +88,7 @@
loading a plugin that needs the plugin API.
----
- Gerrit-ApiType: plugin
+Gerrit-ApiType: plugin
----
=== Explicit Registration
@@ -103,9 +103,9 @@
`@Listen` and `@Export("")` annotations.
----
- Gerrit-Module: tld.example.project.CoreModuleClassName
- Gerrit-SshModule: tld.example.project.SshModuleClassName
- Gerrit-HttpModule: tld.example.project.HttpModuleClassName
+Gerrit-Module: tld.example.project.CoreModuleClassName
+Gerrit-SshModule: tld.example.project.SshModuleClassName
+Gerrit-HttpModule: tld.example.project.HttpModuleClassName
----
=== Batch runtime
@@ -120,7 +120,7 @@
offline reindexing task.
----
- Gerrit-BatchModule: tld.example.project.CoreModuleClassName
+Gerrit-BatchModule: tld.example.project.CoreModuleClassName
----
In this runtime, only the module designated by `Gerrit-BatchModule` is
@@ -132,7 +132,7 @@
A plugin can optionally provide its own plugin name.
----
- Gerrit-PluginName: replication
+Gerrit-PluginName: replication
----
This is useful for plugins that contribute plugin-owned capabilities that
@@ -218,7 +218,7 @@
with no down time.
----
- Gerrit-ReloadMode: restart
+Gerrit-ReloadMode: restart
----
In either mode ('restart' or 'reload') any plugin or extension can
@@ -261,7 +261,7 @@
credentials and possibly verify connectivity to validate them.
----
- Gerrit-InitStep: tld.example.project.MyInitStep
+Gerrit-InitStep: tld.example.project.MyInitStep
----
MyInitStep needs to follow the standard Gerrit InitStep syntax
@@ -278,37 +278,37 @@
[source,java]
----
- public class MyInitStep implements InitStep {
- private final String pluginName;
- private final ConsoleUI ui;
- private final AllProjectsConfig allProjectsConfig;
+public class MyInitStep implements InitStep {
+ private final String pluginName;
+ private final ConsoleUI ui;
+ private final AllProjectsConfig allProjectsConfig;
- @Inject
- public MyInitStep(@PluginName String pluginName, ConsoleUI ui,
- AllProjectsConfig allProjectsConfig) {
- this.pluginName = pluginName;
- this.ui = ui;
- this.allProjectsConfig = allProjectsConfig;
- }
-
- @Override
- public void run() throws Exception {
- }
-
- @Override
- public void postRun() throws Exception {
- ui.message("\n");
- ui.header(pluginName + " Integration");
- boolean enabled = ui.yesno(true, "By default enabled for all projects");
- Config cfg = allProjectsConfig.load().getConfig();
- if (enabled) {
- cfg.setBoolean("plugin", pluginName, "enabled", enabled);
- } else {
- cfg.unset("plugin", pluginName, "enabled");
- }
- allProjectsConfig.save(pluginName, "Initialize " + pluginName + " Integration");
- }
+ @Inject
+ public MyInitStep(@PluginName String pluginName, ConsoleUI ui,
+ AllProjectsConfig allProjectsConfig) {
+ this.pluginName = pluginName;
+ this.ui = ui;
+ this.allProjectsConfig = allProjectsConfig;
}
+
+ @Override
+ public void run() throws Exception {
+ }
+
+ @Override
+ public void postRun() throws Exception {
+ ui.message("\n");
+ ui.header(pluginName + " Integration");
+ boolean enabled = ui.yesno(true, "By default enabled for all projects");
+ Config cfg = allProjectsConfig.load().getConfig();
+ if (enabled) {
+ cfg.setBoolean("plugin", pluginName, "enabled", enabled);
+ } else {
+ cfg.unset("plugin", pluginName, "enabled");
+ }
+ allProjectsConfig.save(pluginName, "Initialize " + pluginName + " Integration");
+ }
+}
----
Bear in mind that the Plugin's InitStep class will be loaded but
@@ -706,9 +706,12 @@
in between, leading to the final operator name. An example
registration looks like this:
- bind(ChangeOperatorFactory.class)
- .annotatedWith(Exports.named("sample"))
- .to(SampleOperator.class);
+[source,java]
+----
+bind(ChangeOperatorFactory.class)
+ .annotatedWith(Exports.named("sample"))
+ .to(SampleOperator.class);
+----
If this is registered in the `myplugin` plugin, then the resulting
operator will be named `sample_myplugin`.
@@ -736,7 +739,7 @@
----
[[search_operands]]
-=== Search Operands ===
+== Search Operands
Plugins can define new search operands to extend change searching.
Plugin methods implementing search operands (returning a
@@ -748,31 +751,33 @@
a module's `configure()` method in the plugin.
The new operand, when used in a search would appear as:
- operatorName:operandName_pluginName
+ `operatorName:operandName_pluginName`
A sample `ChangeHasOperandFactory` class implementing, and registering, a
new `has:sample_pluginName` operand is shown below:
-====
- public class SampleHasOperand implements ChangeHasOperandFactory {
- public static class Module extends AbstractModule {
- @Override
- protected void configure() {
- bind(ChangeHasOperandFactory.class)
- .annotatedWith(Exports.named("sample")
- .to(SampleHasOperand.class);
- }
- }
-
+[source, java]
+----
+public class SampleHasOperand implements ChangeHasOperandFactory {
+ public static class Module extends AbstractModule {
@Override
- public Predicate<ChangeData> create(ChangeQueryBuilder builder)
- throws QueryParseException {
- return new HasSamplePredicate();
+ protected void configure() {
+ bind(ChangeHasOperandFactory.class)
+ .annotatedWith(Exports.named("sample")
+ .to(SampleHasOperand.class);
}
-====
+ }
+
+ @Override
+ public Predicate<ChangeData> create(ChangeQueryBuilder builder)
+ throws QueryParseException {
+ return new HasSamplePredicate();
+ }
+}
+----
[[command_options]]
-=== Command Options ===
+== Command Options
Plugins can provide additional options for each of the gerrit ssh and the
REST API commands by implementing the DynamicBean interface and registering
@@ -801,6 +806,7 @@
logger.atSevere().log("Say Hello in the Log %s", arg);
}
}
+}
----
=== Calling Command Options ===
@@ -862,7 +868,7 @@
----
[[query_attributes]]
-=== Change Attributes ===
+== Change Attributes
==== ChangePluginDefinedInfoFactory
@@ -938,13 +944,9 @@
}
----
-Example
+Example:
----
-
-ssh -p 29418 localhost gerrit query --myplugin-name--all "change:1" --format json
-
-Output:
-
+$ ssh -p 29418 localhost gerrit query --myplugin-name--all "change:1" --format json
{
"url" : "http://localhost:8080/1",
"plugins" : [
@@ -957,10 +959,7 @@
...
}
-curl http://localhost:8080/changes/1?myplugin-name--all
-
-Output:
-
+$ curl http://localhost:8080/changes/1?myplugin-name--all
{
"_number": 1,
...
@@ -1112,8 +1111,8 @@
`plugin.helloworld` subsection:
----
- [plugin "helloworld"]
- enabled = true
+[plugin "helloworld"]
+ enabled = true
----
Via the `com.google.gerrit.server.config.PluginConfigFactory` class a
@@ -1316,7 +1315,7 @@
Here and example of ref-updated JSON event payload with `instanceId`:
[source,json]
----
+----
{
"submitter": {
"name": "Administrator",
@@ -1333,7 +1332,7 @@
"eventCreatedOn": 1588849085,
"instanceId": "instance1"
}
----
+----
[[capabilities]]
== Plugin Owned Capabilities
@@ -1552,9 +1551,9 @@
Example config:
----
[extension-panels "CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK"]
- panel = helloworld.change_id
- panel = myotherplugin
- panel = myplugin.my_panel_name
+ panel = helloworld.change_id
+ panel = myotherplugin
+ panel = myplugin.my_panel_name
----
@@ -1779,11 +1778,11 @@
can be accessed from any REST client, i. e.:
----
- curl -X POST -H "Content-Type: application/json" \
+$ curl -X POST -H "Content-Type: application/json" \
-d '{message: "François", french: true}' \
--user joe:secret \
http://host:port/a/changes/1/revisions/1/cookbook~say-hello
- "Bonjour François from change 1, patch set 1!"
+"Bonjour François from change 1, patch set 1!"
----
A special case is to bind an endpoint without a view name. This is
@@ -1880,7 +1879,6 @@
[source,java]
----
public class MyTopMenuExtension implements TopMenu {
-
@Override
public List<MenuEntry> getEntries() {
return Lists.newArrayList(
@@ -1897,7 +1895,6 @@
[source,java]
----
public class MyTopMenuExtension implements TopMenu {
-
@Override
public List<MenuEntry> getEntries() {
return Lists.newArrayList(
@@ -1915,17 +1912,17 @@
specific requests and add an menu item for this:
[source,java]
----
- new MenuItem("My Screen", "/plugins/myplugin/project/${projectName}");
----
+----
+new MenuItem("My Screen", "/plugins/myplugin/project/${projectName}");
+----
This also enables plugins to provide menu items for project aware
screens:
[source,java]
----
- new MenuItem("My Screen", "/x/my-screen/for/${projectName}");
----
+----
+new MenuItem("My Screen", "/x/my-screen/for/${projectName}");
+----
If no Guice modules are declared in the manifest, the top menu extension may use
auto-registration by providing an `@Listen` annotation:
@@ -2139,7 +2136,6 @@
bind(AccountExternalIdCreator.class)
.annotatedWith(UniqueAnnotations.create())
.to(MyExternalIdCreator.class);
-}
----
[[download-commands]]
@@ -2206,7 +2202,6 @@
@Listen
public class MyWeblinkPlugin implements PatchSetWebLink {
-
private String name = "MyLink";
private String placeHolderUrlProjectCommit = "http://my.tool.com/project=%s/commit=%s";
private String imageUrl = "http://placehold.it/16x16.gif";
@@ -2286,7 +2281,6 @@
import com.google.inject.servlet.ServletModule;
public class HttpModule extends ServletModule {
-
@Override
protected void configureServlets() {
serveRegex(URL_REGEX).with(LfsApiServlet.class);
@@ -2297,7 +2291,7 @@
import org.eclipse.jgit.lfs.server.s3.S3Repository;
public class S3LargeFileRepository extends S3Repository {
-...
+ ...
}
----
@@ -2347,8 +2341,8 @@
file. For example:
----
- [plugin "my-plugin"]
- metricsPrefix = my-metrics
+[plugin "my-plugin"]
+ metricsPrefix = my-metrics
----
will cause the metrics to be recorded under `my-metrics/${metric-name}`.
@@ -2371,6 +2365,7 @@
implementation, e.g. one that supports cluster setup with multiple
primary Gerrit nodes handling write operations.
+[source,java]
----
DynamicItem.bind(binder(), AccountPatchReviewStore.class)
.to(MultiMasterAccountPatchReviewStore.class);
@@ -2592,6 +2587,8 @@
@Override
public String intercept(String in) {
return pluginName + " mycommand";
+ }
+}
----
[[ssh-command-execution-interception]]
@@ -2625,7 +2622,8 @@
And then declare it in your SSH module:
[source, java]
----
- DynamicSet.bind(binder(), SshExecuteCommandInterceptor.class).to(SshExecuteCommandInterceptorImpl.class);
+DynamicSet.bind(binder(), SshExecuteCommandInterceptor.class)
+ .to(SshExecuteCommandInterceptorImpl.class);
----
[[pre-submit-evaluator]]
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index 0cf605b..b22788a 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -305,8 +305,9 @@
+
Slash ('/') is used path separator.
+
-More examples:
-* `-file:^path/.*` - changes that do not modify files from `path/`,
+*More examples:*
+
+* `-file:^path/.*` - changes that do not modify files from `path/`.
* `file:{^~(path/.*)}` - changes that modify files not from `path/` (but may
contain files from `path/`).
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.ts b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.ts
index e9a6158..880b397 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.ts
@@ -117,8 +117,8 @@
);
}
- _computeDisabled(editable: string) {
- return editable === 'false';
+ _computeDisabled(editable: boolean) {
+ return !editable;
}
_computeChecked(value = 'false') {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js
index 168984a..28ef2f8 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js
@@ -39,8 +39,10 @@
});
test('_computeDisabled', () => {
- assert.isFalse(element._computeDisabled('true'));
- assert.isTrue(element._computeDisabled('false'));
+ assert.isFalse(element._computeDisabled(true));
+ assert.isTrue(element._computeDisabled(undefined));
+ assert.isTrue(element._computeDisabled(null));
+ assert.isTrue(element._computeDisabled(false));
});
test('_handleChange', () => {
@@ -75,7 +77,7 @@
test('ARRAY type option', () => {
element.pluginData = {
name: 'testName',
- config: {plugin: {value: 'test', type: 'ARRAY'}},
+ config: {plugin: {value: 'test', type: 'ARRAY', editable: true}},
};
flush();
@@ -90,7 +92,7 @@
test('BOOLEAN type option', () => {
element.pluginData = {
name: 'testName',
- config: {plugin: {value: 'true', type: 'BOOLEAN'}},
+ config: {plugin: {value: 'true', type: 'BOOLEAN', editable: true}},
};
flush();
@@ -109,7 +111,7 @@
test('INT/LONG/STRING type option', () => {
element.pluginData = {
name: 'testName',
- config: {plugin: {value: 'test', type: 'STRING'}},
+ config: {plugin: {value: 'test', type: 'STRING', editable: true}},
};
flush();
@@ -130,7 +132,9 @@
const permitted_values = ['test', 'newTest'];
element.pluginData = {
name: 'testName',
- config: {plugin: {value: 'test', type: 'LIST', permitted_values}},
+ config: {plugin:
+ {value: 'test', type: 'LIST', editable: true, permitted_values},
+ },
};
flush();