Merge branch 'stable-3.0' into stable-3.1
* stable-3.0:
Upgrade bazlets to latest stable-3.0
Clean-up definition of gerrit API jars
Upgrade bazlets to latest stable-3.0
Change-Id: I031e41e5c7d7eabcf4462ec60d2a88514bdc6794
diff --git a/WORKSPACE b/WORKSPACE
index 4772563..60182d1 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "2629e3802493a45cdc7a3e03deb3331743daa09c",
+ commit = "69ae6ee516ec1cc51d0a07fe4419a325eb9063ce",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/rv-reviewers/rv-filter-section.html b/rv-reviewers/rv-filter-section.html
index c657bda..7513675 100644
--- a/rv-reviewers/rv-filter-section.html
+++ b/rv-reviewers/rv-filter-section.html
@@ -58,12 +58,18 @@
<div class="header">
<div class="name">
<h3>Filter:</h3>
- <input
+ <iron-input
id="editFilterInput"
bind-value="{{filter}}"
- is="iron-input"
type="text"
disabled="[[_computeFilterInputDisabled(canModifyConfig, _originalFilter)]]">
+ <input
+ id="editFilterInput"
+ bind-value="{{filter}}"
+ is="iron-input"
+ type="text"
+ disabled="[[_computeFilterInputDisabled(canModifyConfig, _originalFilter)]]">
+ </iron-input>
<gr-button
id="cancelBtn"
on-tap="_handleCancel"
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewers.java
index c82fa7c..43266a2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewers.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewers.java
@@ -15,12 +15,12 @@
package com.googlesource.gerrit.plugins.reviewers;
import com.google.common.flogger.FluentLogger;
+import com.google.gerrit.entities.Account;
import com.google.gerrit.extensions.api.GerritApi;
import com.google.gerrit.extensions.api.changes.AddReviewerInput;
import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.restapi.RestApiException;
-import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.util.RequestContext;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewersByConfiguration.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewersByConfiguration.java
index 6d291a4..788629c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewersByConfiguration.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/AddReviewersByConfiguration.java
@@ -14,9 +14,9 @@
package com.googlesource.gerrit.plugins.reviewers;
+import com.google.gerrit.entities.Account;
import com.google.gerrit.extensions.api.GerritApi;
import com.google.gerrit.extensions.common.ChangeInfo;
-import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.util.ThreadLocalRequestContext;
import com.google.inject.Inject;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/GetReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/GetReviewers.java
index 7ee4c83..61406fa 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/GetReviewers.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/GetReviewers.java
@@ -14,6 +14,7 @@
package com.googlesource.gerrit.plugins.reviewers;
+import com.google.gerrit.extensions.restapi.Response;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.server.project.ProjectResource;
@@ -31,7 +32,8 @@
}
@Override
- public List<ReviewerFilterSection> apply(ProjectResource resource) throws RestApiException {
- return config.forProject(resource.getNameKey()).getReviewerFilterSections();
+ public Response<List<ReviewerFilterSection>> apply(ProjectResource resource)
+ throws RestApiException {
+ return Response.ok(config.forProject(resource.getNameKey()).getReviewerFilterSections());
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/PutReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/PutReviewers.java
index 5240bc8..ccb57b7 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/PutReviewers.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/PutReviewers.java
@@ -17,16 +17,17 @@
import static com.googlesource.gerrit.plugins.reviewers.ModifyReviewersConfigCapability.MODIFY_REVIEWERS_CONFIG;
import com.google.common.flogger.FluentLogger;
+import com.google.gerrit.entities.Project;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.extensions.api.access.PluginPermission;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
+import com.google.gerrit.extensions.restapi.Response;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.extensions.restapi.RestModifyView;
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
-import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.account.AccountResolver;
import com.google.gerrit.server.account.AccountResolver.UnresolvableAccountException;
import com.google.gerrit.server.git.meta.MetaDataUpdate;
@@ -82,7 +83,7 @@
}
@Override
- public List<ReviewerFilterSection> apply(ProjectResource rsrc, Input input)
+ public Response<List<ReviewerFilterSection>> apply(ProjectResource rsrc, Input input)
throws RestApiException, PermissionBackendException {
Project.NameKey projectName = rsrc.getNameKey();
ReviewersConfig.ForProject cfg = config.forProject(projectName);
@@ -142,7 +143,7 @@
} catch (IOException err) {
throw new ResourceNotFoundException(projectName.get(), err);
}
- return cfg.getReviewerFilterSections();
+ return Response.ok(cfg.getReviewerFilterSections());
}
private void validateReviewer(String reviewer) throws RestApiException {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/Reviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Reviewers.java
index c2eae68..fcf4790 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/Reviewers.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/Reviewers.java
@@ -22,6 +22,9 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Nullable;
+import com.google.gerrit.entities.Account;
+import com.google.gerrit.entities.Change;
+import com.google.gerrit.entities.Project;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.common.ChangeInfo;
@@ -30,9 +33,6 @@
import com.google.gerrit.extensions.events.RevisionCreatedListener;
import com.google.gerrit.extensions.events.WorkInProgressStateChangedListener;
import com.google.gerrit.index.query.QueryParseException;
-import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.change.ReviewerSuggestion;
import com.google.gerrit.server.change.SuggestedReviewer;
@@ -44,6 +44,7 @@
import com.google.inject.Singleton;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.Future;
@Singleton
class Reviewers
@@ -158,7 +159,8 @@
byConfigFactory.create(
c, resolver.resolve(reviewers, projectName, changeNumber, uploader));
- workQueue.getDefaultQueue().submit(task);
+ @SuppressWarnings("unused")
+ Future<?> ignored = workQueue.getDefaultQueue().submit(task);
} catch (QueryParseException e) {
logger.atWarning().log(
"Could not add default reviewers for change %d of project %s, filter is invalid: %s",
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfig.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfig.java
index b277d62..7c61c70 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfig.java
@@ -18,9 +18,9 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.FluentLogger;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.RefNames;
import com.google.gerrit.extensions.annotations.PluginName;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.config.PluginConfigFactory;
import com.google.gerrit.server.git.meta.VersionedMetaData;
import com.google.gerrit.server.project.NoSuchProjectException;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java
index 7556553..0d00272 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolver.java
@@ -20,11 +20,11 @@
import com.google.common.collect.Sets;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Nullable;
+import com.google.gerrit.entities.Account;
+import com.google.gerrit.entities.Project;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
-import com.google.gerrit.reviewdb.client.Account;
-import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.account.AccountResolver;
import com.google.gerrit.server.account.GroupMembers;
import com.google.gerrit.server.group.GroupResolver;
@@ -56,14 +56,14 @@
}
/**
- * Resolve a set of account names to {@link com.google.gerrit.reviewdb.client.Account.Id}s. Group
- * names are resolved to their account members.
+ * Resolve a set of account names to {@link com.google.gerrit.entities.Account.Id}s. Group names
+ * are resolved to their account members.
*
* @param names the set of account names to convert
* @param project the project name
* @param changeNumber the change Id
* @param uploader account to use to look up groups, or null if groups are not needed
- * @return set of {@link com.google.gerrit.reviewdb.client.Account.Id}s.
+ * @return set of {@link com.google.gerrit.entities.Account.Id}s.
*/
@VisibleForTesting
Set<Account.Id> resolve(
@@ -91,7 +91,7 @@
try {
AccountResolver.Result result = accountResolver.resolve(accountName);
if (result.asList().size() == 1) {
- Account.Id id = result.asList().get(0).getAccount().getId();
+ Account.Id id = result.asList().get(0).account().id();
if (uploader == null || id.get() != uploader._accountId) {
reviewers.add(id);
return true;
@@ -117,7 +117,7 @@
groupMembers.listAccounts(groupResolver.get().parse(group).getGroupUUID(), project)
.stream()
.filter(Account::isActive)
- .map(Account::getId)
+ .map(Account::id)
.collect(toSet());
reviewers.addAll(accounts);
} catch (UnprocessableEntityException e) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewers/SuggestProjectReviewers.java b/src/main/java/com/googlesource/gerrit/plugins/reviewers/SuggestProjectReviewers.java
index 5329f7c..8c2e1ee 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewers/SuggestProjectReviewers.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewers/SuggestProjectReviewers.java
@@ -14,12 +14,14 @@
package com.googlesource.gerrit.plugins.reviewers;
+import com.google.gerrit.entities.Account;
import com.google.gerrit.exceptions.StorageException;
+import com.google.gerrit.extensions.client.ReviewerState;
import com.google.gerrit.extensions.common.AccountVisibility;
import com.google.gerrit.extensions.common.SuggestedReviewerInfo;
import com.google.gerrit.extensions.restapi.BadRequestException;
+import com.google.gerrit.extensions.restapi.Response;
import com.google.gerrit.extensions.restapi.RestReadView;
-import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.permissions.PermissionBackend;
import com.google.gerrit.server.permissions.PermissionBackendException;
@@ -49,11 +51,12 @@
}
@Override
- public List<SuggestedReviewerInfo> apply(ProjectResource rsrc)
+ public Response<List<SuggestedReviewerInfo>> apply(ProjectResource rsrc)
throws BadRequestException, StorageException, IOException, ConfigInvalidException,
PermissionBackendException {
- return reviewersUtil.suggestReviewers(
- null, this, rsrc.getProjectState(), getVisibility(rsrc), true);
+ return Response.ok(
+ reviewersUtil.suggestReviewers(
+ ReviewerState.REVIEWER, null, this, rsrc.getProjectState(), getVisibility(rsrc), true));
}
private VisibilityControl getVisibility(final ProjectResource rsrc) {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfigIT.java b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfigIT.java
index 4356b90..1a280e2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfigIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersConfigIT.java
@@ -26,8 +26,8 @@
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.TestPlugin;
import com.google.gerrit.acceptance.testsuite.project.ProjectOperations;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.RefNames;
+import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.RefNames;
import com.google.inject.Inject;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.Config;
diff --git a/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersIT.java b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersIT.java
index fdc7fe4..6d31562 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersIT.java
@@ -15,7 +15,7 @@
package com.googlesource.gerrit.plugins.reviewers;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth.assert_;
+import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.gerrit.acceptance.GitUtil.fetch;
import static com.google.gerrit.extensions.client.ReviewerState.REVIEWER;
import static com.googlesource.gerrit.plugins.reviewers.ReviewersConfig.FILENAME;
@@ -29,9 +29,11 @@
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.acceptance.TestPlugin;
+import com.google.gerrit.acceptance.testsuite.project.ProjectOperations;
+import com.google.gerrit.entities.BranchNameKey;
+import com.google.gerrit.entities.RefNames;
import com.google.gerrit.extensions.common.AccountInfo;
-import com.google.gerrit.reviewdb.client.Branch;
-import com.google.gerrit.reviewdb.client.RefNames;
+import com.google.inject.Inject;
import java.util.Collection;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -41,6 +43,8 @@
@NoHttpd
@TestPlugin(name = "reviewers", sysModule = "com.googlesource.gerrit.plugins.reviewers.Module")
public class ReviewersIT extends LightweightPluginDaemonTest {
+ @Inject private ProjectOperations projectOperations;
+
@Before
public void setUp() throws Exception {
fetch(testRepo, RefNames.REFS_CONFIG + ":refs/heads/config");
@@ -49,7 +53,7 @@
@Test
public void addReviewers() throws Exception {
- RevCommit oldHead = getRemoteHead();
+ RevCommit oldHead = projectOperations.project(project).getHead("master");
TestAccount user2 = accountCreator.user2();
Config cfg = new Config();
@@ -74,19 +78,18 @@
Thread.sleep(10);
wait += 10;
if (wait > 100) {
- assert_().fail("Timeout of 100 ms exceeded");
+ assertWithMessage("Timeout of 100 ms exceeded").fail();
}
}
} while (reviewers == null);
assertThat(reviewers.stream().map(a -> a._accountId).collect(toSet()))
- .containsExactlyElementsIn(
- ImmutableSet.of(admin.id().get(), user.id().get(), user2.id().get()));
+ .containsExactlyElementsIn(ImmutableSet.of(user.id().get(), user2.id().get()));
}
@Test
public void addReviewersMatchMultipleSections() throws Exception {
- RevCommit oldHead = getRemoteHead();
+ RevCommit oldHead = projectOperations.project(project).getHead("master");
TestAccount user2 = accountCreator.user2();
Config cfg = new Config();
@@ -111,19 +114,18 @@
Thread.sleep(10);
wait += 10;
if (wait > 100) {
- assert_().fail("Timeout of 100 ms exceeded");
+ assertWithMessage("Timeout of 100 ms exceeded").fail();
}
}
} while (reviewers == null);
assertThat(reviewers.stream().map(a -> a._accountId).collect(toSet()))
- .containsExactlyElementsIn(
- ImmutableSet.of(admin.id().get(), user.id().get(), user2.id().get()));
+ .containsExactlyElementsIn(ImmutableSet.of(user.id().get(), user2.id().get()));
}
@Test
public void doNotAddReviewersFromNonMatchingFilters() throws Exception {
- RevCommit oldHead = getRemoteHead();
+ RevCommit oldHead = projectOperations.project(project).getHead("master");
Config cfg = new Config();
cfg.setString(SECTION_FILTER, "branch:master", KEY_REVIEWER, user.email());
@@ -135,7 +137,7 @@
testRepo.reset(oldHead);
- createBranch(Branch.nameKey(project, "other-branch"));
+ createBranch(BranchNameKey.create(project, "other-branch"));
// Create a change that matches the filter section.
createChange("refs/for/master");
@@ -156,7 +158,7 @@
@Test
public void addReviewersFromMatchingFilters() throws Exception {
- RevCommit oldHead = getRemoteHead();
+ RevCommit oldHead = projectOperations.project(project).getHead("master");
Config cfg = new Config();
cfg.setString(SECTION_FILTER, "branch:other-branch", KEY_REVIEWER, user.email());
@@ -168,7 +170,7 @@
testRepo.reset(oldHead);
- createBranch(Branch.nameKey(project, "other-branch"));
+ createBranch(BranchNameKey.create(project, "other-branch"));
// Create a change that doesn't match the filter section.
createChange("refs/for/master");
@@ -185,6 +187,6 @@
} while (reviewers == null && wait < 100);
assertThat(reviewers.stream().map(a -> a._accountId).collect(toSet()))
- .containsExactlyElementsIn(ImmutableSet.of(admin.id().get(), user.id().get()));
+ .containsExactlyElementsIn(ImmutableSet.of(user.id().get()));
}
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolverIT.java b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolverIT.java
index 185e4cd..38f367d 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolverIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/reviewers/ReviewersResolverIT.java
@@ -21,7 +21,7 @@
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.acceptance.testsuite.group.GroupOperations;
-import com.google.gerrit.reviewdb.client.Account;
+import com.google.gerrit.entities.Account;
import com.google.inject.Inject;
import java.util.Collections;
import java.util.Set;