Merge branch 'stable-3.1' into stable-3.2
* stable-3.1:
ReceiveCommits: Parse body before accessing full commit message
Add anchor for account query options
ElasticContainer: Upgrade V6_8 to elasticsearch 6.8.9
ElasticVersion: Replace unchecked throw w/ javadoc
Remove obsolete parts from Java code style guide
Elasticsearch: Remove support for EOL 6.5 version
Fix edit diff url
Decode group id (for UUID) in gr-group
Change-Id: I556584e4649919b4fe74cbd3bc29db141b82c00b
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index d342990..d96ebcc 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -3202,11 +3202,6 @@
For further information about Elasticsearch security, please refer to the documentation:
-* link:https://www.elastic.co/guide/en/x-pack/5.6/security-getting-started.html[Elasticsearch 5.6,role=external,window=_blank]
-* link:https://www.elastic.co/guide/en/x-pack/6.2/security-getting-started.html[Elasticsearch 6.2,role=external,window=_blank]
-* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.3/security-getting-started.html[Elasticsearch 6.3,role=external,window=_blank]
-* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.4/security-getting-started.html[Elasticsearch 6.4,role=external,window=_blank]
-* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.5/security-getting-started.html[Elasticsearch 6.5,role=external,window=_blank]
* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.6/security-getting-started.html[Elasticsearch 6.6,role=external,window=_blank]
[[elasticsearch.username]]elasticsearch.username::
diff --git a/Documentation/dev-crafting-changes.txt b/Documentation/dev-crafting-changes.txt
index 8d0cee2..5a54c5f 100644
--- a/Documentation/dev-crafting-changes.txt
+++ b/Documentation/dev-crafting-changes.txt
@@ -108,7 +108,7 @@
change, so that reviewers will do it for you. Yes, the way to go is to
extend gerrit CI to take care of this, but it's not yet implemented.
-Gerrit generally follows the
+Gerrit follows the
link:https://google.github.io/styleguide/javaguide.html[Google Java Style
Guide,role=external,window=_blank].
@@ -129,19 +129,6 @@
wrapper script. If you run your own copy, please use the same version,
as there may be slight differences between versions.
-When considering the style beyond just formatting rules, it is often
-more important to match the style of the nearby code which you are
-modifying than it is to match the style guide exactly. This is
-especially true within the same file.
-
-Additionally, you will notice that most of the newline spacing
-is fairly consistent throughout the code in Gerrit, it helps to
-stick to the blank line conventions. Here are some specific
-examples:
-
- * Keep a blank line between all class and method declarations.
- * Do not add blank lines at the beginning or end of class/methods.
-
When to use `final` modifier and when not (in new code):
Always:
diff --git a/Documentation/rest-api-accounts.txt b/Documentation/rest-api-accounts.txt
index b073872..6fbedb0 100644
--- a/Documentation/rest-api-accounts.txt
+++ b/Documentation/rest-api-accounts.txt
@@ -52,6 +52,7 @@
The `S` or `start` query parameter can be supplied to skip a number
of accounts from the list.
+[[query-options]]
Additional fields can be obtained by adding `o` parameters, each
option slows down the query response time to the client so they are
generally disabled by default. Optional fields are:
diff --git a/java/com/google/gerrit/elasticsearch/ElasticVersion.java b/java/com/google/gerrit/elasticsearch/ElasticVersion.java
index 82816fb..fb24cb0 100644
--- a/java/com/google/gerrit/elasticsearch/ElasticVersion.java
+++ b/java/com/google/gerrit/elasticsearch/ElasticVersion.java
@@ -18,7 +18,6 @@
import java.util.regex.Pattern;
public enum ElasticVersion {
- V6_5("6.5.*"),
V6_6("6.6.*"),
V6_7("6.7.*"),
V6_8("6.8.*"),
@@ -48,7 +47,14 @@
}
}
- public static ElasticVersion forVersion(String version) throws UnsupportedVersion {
+ /**
+ * Convert a version String to an ElasticVersion if supported.
+ *
+ * @param version for which to return an ElasticVersion
+ * @return the corresponding ElasticVersion if supported
+ * @throws UnsupportedVersion
+ */
+ public static ElasticVersion forVersion(String version) {
for (ElasticVersion value : ElasticVersion.values()) {
if (value.pattern.matcher(version).matches()) {
return value;
diff --git a/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java b/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java
index e4b45ed..df3ec5e 100644
--- a/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java
+++ b/javatests/com/google/gerrit/elasticsearch/ElasticContainer.java
@@ -38,14 +38,12 @@
private static String getImageName(ElasticVersion version) {
switch (version) {
- case V6_5:
- return "blacktop/elasticsearch:6.5.4";
case V6_6:
return "blacktop/elasticsearch:6.6.2";
case V6_7:
return "blacktop/elasticsearch:6.7.2";
case V6_8:
- return "blacktop/elasticsearch:6.8.8";
+ return "blacktop/elasticsearch:6.8.9";
case V7_0:
return "blacktop/elasticsearch:7.0.1";
case V7_1:
diff --git a/javatests/com/google/gerrit/elasticsearch/ElasticVersionTest.java b/javatests/com/google/gerrit/elasticsearch/ElasticVersionTest.java
index e36ff0b..280b884 100644
--- a/javatests/com/google/gerrit/elasticsearch/ElasticVersionTest.java
+++ b/javatests/com/google/gerrit/elasticsearch/ElasticVersionTest.java
@@ -22,9 +22,6 @@
public class ElasticVersionTest {
@Test
public void supportedVersion() throws Exception {
- assertThat(ElasticVersion.forVersion("6.5.0")).isEqualTo(ElasticVersion.V6_5);
- assertThat(ElasticVersion.forVersion("6.5.1")).isEqualTo(ElasticVersion.V6_5);
-
assertThat(ElasticVersion.forVersion("6.6.0")).isEqualTo(ElasticVersion.V6_6);
assertThat(ElasticVersion.forVersion("6.6.1")).isEqualTo(ElasticVersion.V6_6);
@@ -70,7 +67,6 @@
@Test
public void atLeastMinorVersion() throws Exception {
- assertThat(ElasticVersion.V6_5.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V6_6.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V6_7.isAtLeastMinorVersion(ElasticVersion.V6_7)).isTrue();
assertThat(ElasticVersion.V6_8.isAtLeastMinorVersion(ElasticVersion.V6_8)).isTrue();
@@ -85,7 +81,6 @@
@Test
public void version6OrLater() throws Exception {
- assertThat(ElasticVersion.V6_5.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V6_6.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V6_7.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V6_8.isV6OrLater()).isTrue();
@@ -100,7 +95,6 @@
@Test
public void version7OrLater() throws Exception {
- assertThat(ElasticVersion.V6_5.isV7OrLater()).isFalse();
assertThat(ElasticVersion.V6_6.isV7OrLater()).isFalse();
assertThat(ElasticVersion.V6_7.isV7OrLater()).isFalse();
assertThat(ElasticVersion.V6_8.isV7OrLater()).isFalse();
diff --git a/polygerrit-ui/app/elements/admin/gr-group/gr-group.js b/polygerrit-ui/app/elements/admin/gr-group/gr-group.js
index fc38c12..1c7cc91 100644
--- a/polygerrit-ui/app/elements/admin/gr-group/gr-group.js
+++ b/polygerrit-ui/app/elements/admin/gr-group/gr-group.js
@@ -264,6 +264,12 @@
_computeGroupDisabled(owner, admin, groupIsInternal) {
return groupIsInternal && (admin || owner) ? false : true;
}
+
+ _getGroupUUID(id) {
+ if (!id) return;
+
+ return id.match(INTERNAL_GROUP_REGEX) ? id : decodeURIComponent(id);
+ }
}
customElements.define(GrGroup.is, GrGroup);
diff --git a/polygerrit-ui/app/elements/admin/gr-group/gr-group_html.js b/polygerrit-ui/app/elements/admin/gr-group/gr-group_html.js
index 56a0f8e..e11f989 100644
--- a/polygerrit-ui/app/elements/admin/gr-group/gr-group_html.js
+++ b/polygerrit-ui/app/elements/admin/gr-group/gr-group_html.js
@@ -45,7 +45,7 @@
<fieldset>
<gr-copy-clipboard
id="uuid"
- text="[[_groupConfig.id]]"
+ text="[[_getGroupUUID(_groupConfig.id)]]"
></gr-copy-clipboard>
</fieldset>
<h3 id="groupName" class$="[[_computeHeaderClass(_rename)]]">
diff --git a/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.html b/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.html
index f708a3d..5621fff 100644
--- a/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.html
@@ -278,6 +278,12 @@
};
assert.equal(element._groupConfig.id, element.$.uuid.text);
+
+ element._groupConfig = {
+ id: 'user%2Fgroup',
+ };
+
+ assert.equal('user/group', element.$.uuid.text);
});
});
</script>
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
index e434e65..717fe4e 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js
@@ -646,8 +646,7 @@
_goToEditFile() {
// TODO(taoalpha): add a shortcut for editing
- const editUrl = GerritNav.getEditUrlForDiff(
- this._change, this._path, this._patchRange.patchNum);
+ const editUrl = GerritNav.getEditUrlForDiff(this._change, this._path);
return GerritNav.navigateToRelativeUrl(editUrl);
}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html
index f5275e2..e9e17da 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html
@@ -403,6 +403,7 @@
};
element._change = {
_number: 42,
+ project: 'gerrit',
status: 'NEW',
revisions: {
a: {_number: 1, commit: {parents: []}},
@@ -416,6 +417,8 @@
assert.isTrue(!!editBtn);
MockInteractions.tap(editBtn);
assert.isTrue(redirectStub.called);
+ assert.isTrue(redirectStub.lastCall.calledWithExactly(
+ GerritNav.getEditUrlForDiff(element._change, element._path)));
done();
});
});