Merge branch 'stable-2.15'

* stable-2.15:
  CommandExecutorQueueProvider: Fix singleton binding
  ReviewerinPredicate: Only return users in state REVIEWER
  Remove documentation about cleaning the build cache
  AbstractQueryChangesTest#reviewerin: Expand to cover CC

Change-Id: I8bc29e2635480ab975bc1a474b333f048bce4eae
This commit is contained in:
David Pursehouse
2018-05-01 10:49:23 +09:00
6 changed files with 34 additions and 24 deletions

View File

@@ -363,18 +363,6 @@ To consume the JGit dependency from the development tree, edit
`lib/jgit/jgit.bzl` setting LOCAL_JGIT_REPO to a directory holding a `lib/jgit/jgit.bzl` setting LOCAL_JGIT_REPO to a directory holding a
JGit repository. JGit repository.
[[clean-download-cache]]
=== Cleaning The download cache
The cache for downloaded artifacts is located in
`~/.gerritcodereview/bazel-cache/downloaded-artifacts`.
If you really do need to clean the download cache manually, then:
----
rm -rf ~/.gerritcodereview/bazel-cache/downloaded-artifacts
----
[[local-action-cache]] [[local-action-cache]]
To accelerate builds, local action cache can be activated. Note, that this To accelerate builds, local action cache can be activated. Note, that this
@@ -423,7 +411,6 @@ build --experimental_repository_cache=/home/<user>/.gerritcodereview/bazel-cache
[NOTE] `experimental_repository_cache` must be absolute path. Expansion of `~` is [NOTE] `experimental_repository_cache` must be absolute path. Expansion of `~` is
unfortunately not supported yet. This is also the reason why we can't activate this unfortunately not supported yet. This is also the reason why we can't activate this
feature by default yet (by adjusting tools/bazel.rc file). feature by default yet (by adjusting tools/bazel.rc file).
GERRIT GERRIT
------ ------
Part of link:index.html[Gerrit Code Review] Part of link:index.html[Gerrit Code Review]

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.pgm.http.jetty; package com.google.gerrit.pgm.http.jetty;
import static com.google.gerrit.server.config.ConfigUtil.getTimeUnit; import static com.google.gerrit.server.config.ConfigUtil.getTimeUnit;
import static com.google.inject.Scopes.SINGLETON;
import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.concurrent.TimeUnit.MINUTES;
import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE; import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
@@ -74,7 +73,7 @@ public class ProjectQoSFilter implements Filter {
public static class Module extends ServletModule { public static class Module extends ServletModule {
@Override @Override
protected void configureServlets() { protected void configureServlets() {
bind(QueueProvider.class).to(CommandExecutorQueueProvider.class).in(SINGLETON); bind(QueueProvider.class).to(CommandExecutorQueueProvider.class);
filterRegex(FILTER_RE).through(ProjectQoSFilter.class); filterRegex(FILTER_RE).through(ProjectQoSFilter.class);
} }
} }

View File

@@ -18,6 +18,7 @@ import com.google.gerrit.index.query.PostFilterPredicate;
import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountGroup; import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.IdentifiedUser; import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.notedb.ReviewerStateInternal;
import com.google.gwtorm.server.OrmException; import com.google.gwtorm.server.OrmException;
public class ReviewerinPredicate extends PostFilterPredicate<ChangeData> { public class ReviewerinPredicate extends PostFilterPredicate<ChangeData> {
@@ -36,7 +37,7 @@ public class ReviewerinPredicate extends PostFilterPredicate<ChangeData> {
@Override @Override
public boolean match(ChangeData object) throws OrmException { public boolean match(ChangeData object) throws OrmException {
for (Account.Id accountId : object.reviewers().all()) { for (Account.Id accountId : object.reviewers().byState(ReviewerStateInternal.REVIEWER)) {
IdentifiedUser reviewer = userFactory.create(accountId); IdentifiedUser reviewer = userFactory.create(accountId);
if (reviewer.getEffectiveGroups().contains(uuid)) { if (reviewer.getEffectiveGroups().contains(uuid)) {
return true; return true;

View File

@@ -19,9 +19,11 @@ import com.google.gerrit.server.config.ThreadSettingsConfig;
import com.google.gerrit.server.git.QueueProvider; import com.google.gerrit.server.git.QueueProvider;
import com.google.gerrit.server.git.WorkQueue; import com.google.gerrit.server.git.WorkQueue;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.Config;
@Singleton
public class CommandExecutorQueueProvider implements QueueProvider { public class CommandExecutorQueueProvider implements QueueProvider {
private int poolSize; private int poolSize;

View File

@@ -89,7 +89,7 @@ public class SshModule extends LifecycleModule {
.annotatedWith(StreamCommandExecutor.class) .annotatedWith(StreamCommandExecutor.class)
.toProvider(StreamCommandExecutorProvider.class) .toProvider(StreamCommandExecutorProvider.class)
.in(SINGLETON); .in(SINGLETON);
bind(QueueProvider.class).to(CommandExecutorQueueProvider.class).in(SINGLETON); bind(QueueProvider.class).to(CommandExecutorQueueProvider.class);
bind(GSSAuthenticator.class).to(GerritGSSAuthenticator.class); bind(GSSAuthenticator.class).to(GerritGSSAuthenticator.class);
bind(PublickeyAuthenticator.class).to(CachingPublicKeyAuthenticator.class); bind(PublickeyAuthenticator.class).to(CachingPublicKeyAuthenticator.class);

View File

@@ -1961,11 +1961,12 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
public void reviewerin() throws Exception { public void reviewerin() throws Exception {
Account.Id user1 = accountManager.authenticate(AuthRequest.forUser("user1")).getAccountId(); Account.Id user1 = accountManager.authenticate(AuthRequest.forUser("user1")).getAccountId();
Account.Id user2 = accountManager.authenticate(AuthRequest.forUser("user2")).getAccountId(); Account.Id user2 = accountManager.authenticate(AuthRequest.forUser("user2")).getAccountId();
Account.Id user3 = accountManager.authenticate(AuthRequest.forUser("user3")).getAccountId();
TestRepository<Repo> repo = createProject("repo"); TestRepository<Repo> repo = createProject("repo");
Change change1 = insert(repo, newChange(repo)); Change change1 = insert(repo, newChange(repo));
Change change2 = insert(repo, newChange(repo)); Change change2 = insert(repo, newChange(repo));
insert(repo, newChange(repo)); Change change3 = insert(repo, newChange(repo));
AddReviewerInput rin = new AddReviewerInput(); AddReviewerInput rin = new AddReviewerInput();
rin.reviewer = user1.toString(); rin.reviewer = user1.toString();
@@ -1977,8 +1978,13 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
rin.state = ReviewerState.REVIEWER; rin.state = ReviewerState.REVIEWER;
gApi.changes().id(change2.getId().get()).addReviewer(rin); gApi.changes().id(change2.getId().get()).addReviewer(rin);
rin = new AddReviewerInput();
rin.reviewer = user3.toString();
rin.state = ReviewerState.CC;
gApi.changes().id(change3.getId().get()).addReviewer(rin);
String group = gApi.groups().create("foo").get().name; String group = gApi.groups().create("foo").get().name;
gApi.groups().id(group).addMembers(user2.toString()); gApi.groups().id(group).addMembers(user2.toString(), user3.toString());
List<String> members = List<String> members =
gApi.groups() gApi.groups()
@@ -1989,15 +1995,30 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
.collect(toList()); .collect(toList());
assertThat(members).contains(user2.toString()); assertThat(members).contains(user2.toString());
assertQuery("reviewerin:\"Registered Users\"", change2, change1); if (notesMigration.readChanges()) {
assertQuery("reviewerin:" + group, change2); // CC and REVIEWER are separate in NoteDB
assertQuery("reviewerin:\"Registered Users\"", change2, change1);
assertQuery("reviewerin:" + group, change2);
} else {
// CC and REVIEWER are the same in ReviewDb
assertQuery("reviewerin:\"Registered Users\"", change3, change2, change1);
assertQuery("reviewerin:" + group, change3, change2);
}
gApi.changes().id(change2.getId().get()).current().review(ReviewInput.approve()); gApi.changes().id(change2.getId().get()).current().review(ReviewInput.approve());
gApi.changes().id(change2.getId().get()).current().submit(); gApi.changes().id(change2.getId().get()).current().submit();
assertQuery("reviewerin:" + group, change2); if (notesMigration.readChanges()) {
assertQuery("project:repo reviewerin:" + group, change2); // CC and REVIEWER are separate in NoteDB
assertQuery("status:merged reviewerin:" + group, change2); assertQuery("reviewerin:" + group, change2);
assertQuery("project:repo reviewerin:" + group, change2);
assertQuery("status:merged reviewerin:" + group, change2);
} else {
// CC and REVIEWER are the same in ReviewDb
assertQuery("reviewerin:" + group, change2, change3);
assertQuery("project:repo reviewerin:" + group, change2, change3);
assertQuery("status:merged reviewerin:" + group, change2);
}
} }
@Test @Test