Merge branch 'stable-2.15' into stable-2.16

* stable-2.15:
  Change bazel-genfiles to bazel-bin as per Bazel 0.25
  AccountIT#deletePreferredEmail: Make assertions more explicit
  Avoid evaluating submit rules twice for open changes

Change-Id: Ia911640d51803723fb22fcdcd6fbceb9a5206eaa
This commit is contained in:
Marco Miller
2019-06-10 14:48:01 -04:00
3 changed files with 24 additions and 7 deletions

View File

@@ -131,7 +131,7 @@ The output archive that contains Java binaries, Java sources and
Java docs will be placed in: Java docs will be placed in:
---- ----
bazel-genfiles/api.zip bazel-bin/api.zip
---- ----
Install {extension,plugin,gwt}-api to the local maven repository: Install {extension,plugin,gwt}-api to the local maven repository:
@@ -155,13 +155,13 @@ Install gerrit.war to the local maven repository:
The output JAR files for individual plugins will be placed in: The output JAR files for individual plugins will be placed in:
---- ----
bazel-genfiles/plugins/<name>/<name>.jar bazel-bin/plugins/<name>/<name>.jar
---- ----
The JAR files will also be packaged in: The JAR files will also be packaged in:
---- ----
bazel-genfiles/plugins/core.zip bazel-bin/plugins/core.zip
---- ----
To build a specific plugin: To build a specific plugin:
@@ -173,7 +173,7 @@ To build a specific plugin:
The output JAR file will be be placed in: The output JAR file will be be placed in:
---- ----
bazel-genfiles/plugins/<name>/<name>.jar bazel-bin/plugins/<name>/<name>.jar
---- ----
Note that when building an individual plugin, the `core.zip` package Note that when building an individual plugin, the `core.zip` package

View File

@@ -936,7 +936,7 @@ public class ChangeData {
} }
public List<SubmitRecord> submitRecords(SubmitRuleOptions options) { public List<SubmitRecord> submitRecords(SubmitRuleOptions options) {
List<SubmitRecord> records = submitRecords.get(options); List<SubmitRecord> records = getCachedSubmitRecord(options);
if (records == null) { if (records == null) {
if (!lazyLoad) { if (!lazyLoad) {
return Collections.emptyList(); return Collections.emptyList();
@@ -949,7 +949,21 @@ public class ChangeData {
@Nullable @Nullable
public List<SubmitRecord> getSubmitRecords(SubmitRuleOptions options) { public List<SubmitRecord> getSubmitRecords(SubmitRuleOptions options) {
return submitRecords.get(options); return getCachedSubmitRecord(options);
}
private List<SubmitRecord> getCachedSubmitRecord(SubmitRuleOptions options) {
List<SubmitRecord> records = submitRecords.get(options);
if (records != null) {
return records;
}
if (options.allowClosed() && change != null && change.getStatus().isOpen()) {
SubmitRuleOptions openSubmitRuleOptions = options.toBuilder().allowClosed(false).build();
return submitRecords.get(openSubmitRuleOptions);
}
return null;
} }
public void setSubmitRecords(SubmitRuleOptions options, List<SubmitRecord> records) { public void setSubmitRecords(SubmitRuleOptions options, List<SubmitRecord> records) {

View File

@@ -1063,6 +1063,7 @@ public class AccountIT extends AbstractDaemonTest {
@Test @Test
public void deletePreferredEmail() throws Exception { public void deletePreferredEmail() throws Exception {
String previous = gApi.accounts().self().get().email;
String email = "foo.bar.baz@example.com"; String email = "foo.bar.baz@example.com";
EmailInput input = new EmailInput(); EmailInput input = new EmailInput();
input.email = email; input.email = email;
@@ -1074,6 +1075,7 @@ public class AccountIT extends AbstractDaemonTest {
// and then again on setting the email preferred. // and then again on setting the email preferred.
accountIndexedCounter.assertReindexOf(admin, 2); accountIndexedCounter.assertReindexOf(admin, 2);
// The new preferred email is set
assertThat(gApi.accounts().self().get().email).isEqualTo(email); assertThat(gApi.accounts().self().get().email).isEqualTo(email);
accountIndexedCounter.clear(); accountIndexedCounter.clear();
@@ -1081,7 +1083,8 @@ public class AccountIT extends AbstractDaemonTest {
accountIndexedCounter.assertReindexOf(admin); accountIndexedCounter.assertReindexOf(admin);
resetCurrentApiUser(); resetCurrentApiUser();
assertThat(getEmails()).doesNotContain(email); assertThat(getEmails()).containsExactly(previous);
assertThat(gApi.accounts().self().get().email).isNull();
} }
@Test @Test