Merge "If indexing fails include the entity ID into the exception message"
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index e866829..f99973a 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -7060,8 +7060,7 @@
[[revert-submission-info]]
=== RevertSubmissionInfo
-The `RevertSubmissionInfo` describes the revert changes. The changes are sorted
-by update time.
+The `RevertSubmissionInfo` entity describes the revert changes.
[options="header",cols="1,6"]
|==============================
diff --git a/WORKSPACE b/WORKSPACE
index e7317af..4a7add7 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -638,36 +638,36 @@
sha1 = "5e3bda828a80c7a21dfbe2308d1755759c2fd7b4",
)
-OW2_VERS = "7.0"
+OW2_VERS = "7.2"
maven_jar(
name = "ow2-asm",
artifact = "org.ow2.asm:asm:" + OW2_VERS,
- sha1 = "d74d4ba0dee443f68fb2dcb7fcdb945a2cd89912",
+ sha1 = "fa637eb67eb7628c915d73762b681ae7ff0b9731",
)
maven_jar(
name = "ow2-asm-analysis",
artifact = "org.ow2.asm:asm-analysis:" + OW2_VERS,
- sha1 = "4b310d20d6f1c6b7197a75f1b5d69f169bc8ac1f",
+ sha1 = "b6e6abe057f23630113f4167c34bda7086691258",
)
maven_jar(
name = "ow2-asm-commons",
artifact = "org.ow2.asm:asm-commons:" + OW2_VERS,
- sha1 = "478006d07b7c561ae3a92ddc1829bca81ae0cdd1",
+ sha1 = "ca2954e8d92a05bacc28ff465b25c70e0f512497",
)
maven_jar(
name = "ow2-asm-tree",
artifact = "org.ow2.asm:asm-tree:" + OW2_VERS,
- sha1 = "29bc62dcb85573af6e62e5b2d735ef65966c4180",
+ sha1 = "3a23cc36edaf8fc5a89cb100182758ccb5991487",
)
maven_jar(
name = "ow2-asm-util",
artifact = "org.ow2.asm:asm-util:" + OW2_VERS,
- sha1 = "18d4d07010c24405129a6dbb0e92057f8779fb9d",
+ sha1 = "a3ae34e57fa8a4040e28247291d0cc3d6b8c7bcf",
)
AUTO_VALUE_VERSION = "1.7"
diff --git a/java/com/google/gerrit/server/restapi/change/RevertSubmission.java b/java/com/google/gerrit/server/restapi/change/RevertSubmission.java
index 88c9bd0..08c0bce 100644
--- a/java/com/google/gerrit/server/restapi/change/RevertSubmission.java
+++ b/java/com/google/gerrit/server/restapi/change/RevertSubmission.java
@@ -78,7 +78,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Queue;
@@ -301,11 +301,7 @@
}
cherryPickInput.base = null;
}
- Collections.sort(
- results,
- (change1, change2) -> {
- return change1.updated.compareTo(change2.updated);
- });
+ results.sort(Comparator.comparing(c -> c.revertOf));
RevertSubmissionInfo revertSubmissionInfo = new RevertSubmissionInfo();
revertSubmissionInfo.revertChanges = results;
return revertSubmissionInfo;
diff --git a/java/com/google/gerrit/server/update/RetryHelper.java b/java/com/google/gerrit/server/update/RetryHelper.java
index bb847a6..bb69453 100644
--- a/java/com/google/gerrit/server/update/RetryHelper.java
+++ b/java/com/google/gerrit/server/update/RetryHelper.java
@@ -363,7 +363,7 @@
public <T> RetryableIndexQueryAction<InternalAccountQuery, T> accountIndexQuery(
String actionName, IndexQueryAction<T, InternalAccountQuery> indexQueryAction) {
return new RetryableIndexQueryAction<>(
- this, internalAccountQuery.get(), actionName, indexQueryAction);
+ this, internalAccountQuery, actionName, indexQueryAction);
}
/**
@@ -379,8 +379,7 @@
*/
public <T> RetryableIndexQueryAction<InternalChangeQuery, T> changeIndexQuery(
String actionName, IndexQueryAction<T, InternalChangeQuery> indexQueryAction) {
- return new RetryableIndexQueryAction<>(
- this, internalChangeQuery.get(), actionName, indexQueryAction);
+ return new RetryableIndexQueryAction<>(this, internalChangeQuery, actionName, indexQueryAction);
}
/**
diff --git a/java/com/google/gerrit/server/update/RetryableIndexQueryAction.java b/java/com/google/gerrit/server/update/RetryableIndexQueryAction.java
index 6e3d0e9..cf733a6 100644
--- a/java/com/google/gerrit/server/update/RetryableIndexQueryAction.java
+++ b/java/com/google/gerrit/server/update/RetryableIndexQueryAction.java
@@ -18,6 +18,7 @@
import com.google.common.base.Throwables;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.index.query.InternalQuery;
+import com.google.inject.Provider;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -42,10 +43,14 @@
RetryableIndexQueryAction(
RetryHelper retryHelper,
- Q internalQuery,
+ Provider<Q> internalQuery,
String actionName,
IndexQueryAction<T, Q> indexQuery) {
- super(retryHelper, ActionType.INDEX_QUERY, actionName, () -> indexQuery.call(internalQuery));
+ super(
+ retryHelper,
+ ActionType.INDEX_QUERY,
+ actionName,
+ () -> indexQuery.call(internalQuery.get()));
}
@Override
diff --git a/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java b/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java
index ab30bef..82cca95 100644
--- a/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java
@@ -23,7 +23,6 @@
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.TestProjectInput;
-import com.google.gerrit.acceptance.UseClockStep;
import com.google.gerrit.acceptance.config.GerritConfig;
import com.google.gerrit.acceptance.testsuite.project.ProjectOperations;
import com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations;
@@ -684,10 +683,6 @@
@Test
@GerritConfig(name = "change.submitWholeTopic", value = "true")
-
- // In this test and some of the following, we use @UseClockStep because the test depends on the
- // update time.
- @UseClockStep
public void revertSubmissionDifferentRepositoriesWithDependantChange() throws Exception {
projectOperations.newProject().name("secondProject").create();
TestRepository<InMemoryRepository> secondRepo =
@@ -709,19 +704,16 @@
getChangeApis(gApi.changes().id(resultCommits.get(1).getChangeId()).revertSubmission());
assertThat(revertChanges).hasSize(3);
- // Ensures that revertChanges[i] is the revert of resultCommits[i] because the reverts are by
- // update time.
- Collections.reverse(resultCommits);
- String sha1FirstChange = resultCommits.get(0).getCommit().getName();
+ String sha1RevertOfTheSecondChange = revertChanges.get(1).current().commit(false).commit;
String sha1SecondChange = resultCommits.get(1).getCommit().getName();
- String sha1SecondRevert = revertChanges.get(1).current().commit(false).commit;
+ String sha1ThirdChange = resultCommits.get(2).getCommit().getName();
assertThat(revertChanges.get(0).current().commit(false).parents.get(0).commit)
- .isEqualTo(sha1FirstChange);
+ .isEqualTo(sha1RevertOfTheSecondChange);
assertThat(revertChanges.get(1).current().commit(false).parents.get(0).commit)
.isEqualTo(sha1SecondChange);
assertThat(revertChanges.get(2).current().commit(false).parents.get(0).commit)
- .isEqualTo(sha1SecondRevert);
+ .isEqualTo(sha1ThirdChange);
assertThat(revertChanges.get(0).current().files().get("a.txt").linesDeleted).isEqualTo(1);
assertThat(revertChanges.get(1).current().files().get("b.txt").linesDeleted).isEqualTo(1);
@@ -777,7 +769,7 @@
gApi.changes().id(secondResult.getChangeId()).current().submit();
List<ChangeApi> revertChanges =
getChangeApis(gApi.changes().id(firstResult.getChangeId()).revertSubmission());
-
+ Collections.reverse(revertChanges);
String sha1SecondChange = secondResult.getCommit().getName();
String sha1FirstRevert = revertChanges.get(0).current().commit(false).commit;
assertThat(revertChanges.get(0).current().commit(false).parents.get(0).commit)
@@ -806,6 +798,7 @@
gApi.changes().id(unrelated).current().submit();
List<ChangeApi> revertChanges =
getChangeApis(gApi.changes().id(firstResult.getChangeId()).revertSubmission());
+ Collections.reverse(revertChanges);
String sha1SecondChange = secondResult.getCommit().getName();
String sha1FirstRevert = revertChanges.get(0).current().commit(false).commit;
assertThat(revertChanges.get(0).current().commit(false).parents.get(0).commit)
@@ -824,7 +817,6 @@
@Test
@GerritConfig(name = "change.submitWholeTopic", value = "true")
- @UseClockStep
public void revertSubmissionDifferentRepositories() throws Exception {
projectOperations.newProject().name("secondProject").create();
TestRepository<InMemoryRepository> secondRepo =
@@ -861,7 +853,6 @@
@Test
@GerritConfig(name = "change.submitWholeTopic", value = "true")
- @UseClockStep
public void revertSubmissionMultipleBranches() throws Exception {
List<PushOneCommit.Result> resultCommits = new ArrayList<>();
String topic = "topic";
@@ -879,16 +870,16 @@
List<ChangeApi> revertChanges =
getChangeApis(gApi.changes().id(resultCommits.get(1).getChangeId()).revertSubmission());
assertThat(revertChanges.get(0).current().files().get("c.txt").linesDeleted).isEqualTo(1);
- assertThat(revertChanges.get(1).current().files().get("b.txt").linesDeleted).isEqualTo(1);
- assertThat(revertChanges.get(2).current().files().get("a.txt").linesDeleted).isEqualTo(1);
+ assertThat(revertChanges.get(1).current().files().get("a.txt").linesDeleted).isEqualTo(1);
+ assertThat(revertChanges.get(2).current().files().get("b.txt").linesDeleted).isEqualTo(1);
String sha1FirstChange = resultCommits.get(0).getCommit().getName();
String sha1ThirdChange = resultCommits.get(2).getCommit().getName();
- String sha1SecondRevert = revertChanges.get(1).current().commit(false).commit;
+ String sha1SecondRevert = revertChanges.get(2).current().commit(false).commit;
assertThat(revertChanges.get(0).current().commit(false).parents.get(0).commit)
.isEqualTo(sha1FirstChange);
- assertThat(revertChanges.get(1).current().commit(false).parents.get(0).commit)
- .isEqualTo(sha1ThirdChange);
assertThat(revertChanges.get(2).current().commit(false).parents.get(0).commit)
+ .isEqualTo(sha1ThirdChange);
+ assertThat(revertChanges.get(1).current().commit(false).parents.get(0).commit)
.isEqualTo(sha1SecondRevert);
assertThat(revertChanges).hasSize(3);
@@ -896,7 +887,6 @@
@Test
@GerritConfig(name = "change.submitWholeTopic", value = "true")
- @UseClockStep
public void revertSubmissionDependantAndUnrelatedWithMerge() throws Exception {
String topic = "topic";
PushOneCommit.Result firstResult =
@@ -925,6 +915,7 @@
List<ChangeApi> revertChanges =
getChangeApis(gApi.changes().id(secondResult.getChangeId()).revertSubmission());
+ Collections.reverse(revertChanges);
assertThat(revertChanges.get(0).current().files().get("c.txt").linesDeleted).isEqualTo(1);
assertThat(revertChanges.get(1).current().files().get("b.txt").linesDeleted).isEqualTo(1);
assertThat(revertChanges.get(2).current().files().get("a.txt").linesDeleted).isEqualTo(1);
@@ -944,7 +935,6 @@
@Test
@GerritConfig(name = "change.submitWholeTopic", value = "true")
- @UseClockStep
public void revertSubmissionUnrelatedWithTwoMergeCommits() throws Exception {
String topic = "topic";
PushOneCommit.Result firstResult =
@@ -974,6 +964,7 @@
List<ChangeApi> revertChanges =
getChangeApis(gApi.changes().id(secondResult.getChangeId()).revertSubmission());
+ Collections.reverse(revertChanges);
assertThat(revertChanges.get(0).current().files().get("c.txt").linesDeleted).isEqualTo(1);
assertThat(revertChanges.get(1).current().files().get("b.txt").linesDeleted).isEqualTo(1);
assertThat(revertChanges.get(2).current().files().get("a.txt").linesDeleted).isEqualTo(1);
diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md
index 461e2b9..41f2ec7 100644
--- a/polygerrit-ui/README.md
+++ b/polygerrit-ui/README.md
@@ -46,6 +46,9 @@
```sh
./polygerrit-ui/run-server.sh
+
+// or
+npm run start
```
Then visit <http://localhost:8081>.
@@ -185,7 +188,7 @@
## Template Type Safety
-> **Warning**: This feature is temporary disabled, because it doesn't work with Polymer 2 and Polymer 3.
+> **Warning**: This feature is temporary disabled, because it doesn't work with Polymer 2 and Polymer 3.
Some of the checks are made by polymer linter.
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js
index 69d3281..f11e5ed 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js
@@ -75,7 +75,10 @@
return editable === 'false';
}
- _computeChecked(value) {
+ /**
+ * @param {?boolean} value - fallback to false if undefined
+ */
+ _computeChecked(value = false) {
return JSON.parse(value);
}
diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js
index c0c42b5..5c98281 100644
--- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js
+++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js
@@ -241,7 +241,7 @@
detail.inBackgroundTab = contextInfo.isInBackgroundTab;
}
if (contextInfo && contextInfo.startTimeMs) {
- detail.startTime = contextInfo.startTimeMs;
+ detail.eventStart = contextInfo.startTimeMs;
}
document.dispatchEvent(new CustomEvent(type, {detail}));
if (opt_noLog) { return; }
diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html
index 7728450..c7aa896 100644
--- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html
+++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html
@@ -261,7 +261,7 @@
'timing-report', 'UI Latency', 'timeAction', 0,
{startTimeMs: 42}
));
- assert.equal(dispatchStub.getCall(2).args[0].detail.startTime, 42);
+ assert.equal(dispatchStub.getCall(2).args[0].detail.eventStart, 42);
});
suite('plugins', () => {
diff --git a/polygerrit-ui/server.go b/polygerrit-ui/server.go
index 3b699c2..ba52ce8 100644
--- a/polygerrit-ui/server.go
+++ b/polygerrit-ui/server.go
@@ -39,12 +39,10 @@
var (
plugins = flag.String("plugins", "", "comma seperated plugin paths to serve")
- port = flag.String("port", ":8081", "Port to serve HTTP requests on")
+ port = flag.String("port", "localhost:8081", "address to serve HTTP requests on")
host = flag.String("host", "gerrit-review.googlesource.com", "Host to proxy requests to")
scheme = flag.String("scheme", "https", "URL scheme")
cdnPattern = regexp.MustCompile("https://cdn.googlesource.com/polygerrit_ui/[0-9.]*")
- webComponentPattern = regexp.MustCompile("webcomponentsjs-p2")
- grAppPattern = regexp.MustCompile("gr-app-p2")
bundledPluginsPattern = regexp.MustCompile("https://cdn.googlesource.com/polygerrit_assets/[0-9.]*")
)
@@ -189,13 +187,9 @@
buf.ReadFrom(reader)
original := buf.String()
- // Replace the webcomponentsjs-p2 with webcomponentsjs
- replaced := webComponentPattern.ReplaceAllString(original, "webcomponentsjs")
- replaced = grAppPattern.ReplaceAllString(replaced, "gr-app")
-
// Simply remove all CDN references, so files are loaded from the local file system or the proxy
// server instead.
- replaced = cdnPattern.ReplaceAllString(replaced, "")
+ replaced := cdnPattern.ReplaceAllString(original, "")
// Modify window.INITIAL_DATA so that it has the same effect as injectLocalPlugins. To achieve
// this let's add JavaScript lines at the end of the <script>...</script> snippet that also