Merge "Do not keep reference to non-singleton ListTags in singleton TagsCollection" into stable-2.12
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/group/GroupsIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/group/GroupsIT.java
index c72edd7..8d1d89f 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/group/GroupsIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/group/GroupsIT.java
@@ -498,7 +498,7 @@
}
private void assertNoMembers(String group) throws Exception {
- assertThat(gApi.groups().id(group).members().isEmpty());
+ assertThat(gApi.groups().id(group).members()).isEmpty();
}
private void assertIncludes(String group, String... expectedNames)
@@ -521,7 +521,7 @@
}
private void assertNoIncludes(String group) throws Exception {
- assertThat(gApi.groups().id(group).includedGroups().isEmpty());
+ assertThat(gApi.groups().id(group).includedGroups()).isEmpty();
}
private AccountGroup getFromCache(String name) throws Exception {
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java
index ddab184..ba98963 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/ActionsIT.java
@@ -102,8 +102,7 @@
assertThat(info.enabled).isNull();
assertThat(info.label).isEqualTo("Submit whole topic");
assertThat(info.method).isEqualTo("POST");
- assertThat(info.title).isEqualTo(
- "See the \"Submitted Together\" tab for problems, specifically see: 2");
+ assertThat(info.title).isEqualTo("Problems with change(s): 2");
} else {
noSubmitWholeTopicAssertions(actions, 1);
}
diff --git a/gerrit-gwtexpui/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtmlBuilderTest.java b/gerrit-gwtexpui/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtmlBuilderTest.java
index 9c9cf06..0862711 100644
--- a/gerrit-gwtexpui/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtmlBuilderTest.java
+++ b/gerrit-gwtexpui/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtmlBuilderTest.java
@@ -61,7 +61,7 @@
final SafeHtmlBuilder b = new SafeHtmlBuilder();
assertThat(b).isSameAs(b.append('a'));
assertThat(b).isSameAs(b.append('b'));
- assertThat("ab");
+ assertThat(b.asString()).isEqualTo("ab");
}
@Test
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java
index 2a3b7c1..22bdae5 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/Submit.java
@@ -95,8 +95,10 @@
"This change depends on other hidden changes which are not ready";
private static final String CLICK_FAILURE_TOOLTIP =
"Clicking the button would fail";
+ private static final String CHANGE_UNMERGEABLE =
+ "Problems with integrating this change";
private static final String CHANGES_NOT_MERGEABLE =
- "See the \"Submitted Together\" tab for problems, specifically see: ";
+ "Problems with change(s): ";
public static class Output {
transient Change change;
@@ -222,12 +224,13 @@
}
/**
+ * @param cd the change the user is currently looking at
* @param cs set of changes to be submitted at once
* @param identifiedUser the user who is checking to submit
* @return a reason why any of the changes is not submittable or null
*/
- private String problemsForSubmittingChangeset(
- ChangeSet cs, IdentifiedUser identifiedUser) {
+ private String problemsForSubmittingChangeset(ChangeData cd, ChangeSet cs,
+ IdentifiedUser identifiedUser) {
try {
@SuppressWarnings("resource")
ReviewDb db = dbProvider.get();
@@ -249,6 +252,11 @@
if (unmergeable == null) {
return CLICK_FAILURE_TOOLTIP;
} else if (!unmergeable.isEmpty()) {
+ for (ChangeData c : unmergeable) {
+ if (c.change().getKey().equals(cd.change().getKey())) {
+ return CHANGE_UNMERGEABLE;
+ }
+ }
return CHANGES_NOT_MERGEABLE + Joiner.on(", ").join(
Iterables.transform(unmergeable,
new Function<ChangeData, String>() {
@@ -310,13 +318,6 @@
.setVisible(false);
}
- Boolean enabled;
- try {
- enabled = cd.isMergeable();
- } catch (OrmException e) {
- throw new OrmRuntimeException("Could not determine mergeability", e);
- }
-
ChangeSet cs;
try {
cs = mergeSuperSet.completeChangeSet(db, cd.change());
@@ -333,8 +334,24 @@
&& !Strings.isNullOrEmpty(topic)
&& topicSize > 1;
- String submitProblems = problemsForSubmittingChangeset(cs,
- resource.getUser());
+ String submitProblems =
+ problemsForSubmittingChangeset(cd, cs, resource.getUser());
+
+ Boolean enabled;
+ try {
+ // Recheck mergeability rather than using value stored in the index,
+ // which may be stale.
+ // TODO(dborowitz): This is ugly; consider providing a way to not read
+ // stored fields from the index in the first place.
+ // cd.setMergeable(null);
+ // That was done in unmergeableChanges which was called by
+ // problemsForSubmittingChangeset, so now it is safe to read from
+ // the cache, as it yields the same result.
+ enabled = cd.isMergeable();
+ } catch (OrmException e) {
+ throw new OrmRuntimeException("Could not determine mergeability", e);
+ }
+
if (submitProblems != null) {
return new UiAction.Description()
.setLabel(treatWithTopic