Merge branch 'stable-3.0'
* stable-3.0: Expose Gerrit's GWT client library in the plugin API Replace usage of Iterables.limit with Java 8 Stream API Follow up to "Adapt gerrit.sh script to work on Alpine Linux" Change-Id: I6b70578cf3f5a5599e521e46d794c586639d7bc9
This commit is contained in:
@@ -24,8 +24,6 @@ import static java.util.stream.Collectors.toSet;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Enums;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.gerrit.common.data.GroupDescription;
|
||||
@@ -1332,7 +1330,7 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData, ChangeQueryBuil
|
||||
int maxTerms = args.indexConfig.maxTerms();
|
||||
if (allMembers.size() > maxTerms) {
|
||||
// limit the number of query terms otherwise Gerrit will barf
|
||||
accounts = ImmutableSet.copyOf(Iterables.limit(allMembers, maxTerms));
|
||||
accounts = allMembers.stream().limit(maxTerms).collect(toSet());
|
||||
} else {
|
||||
accounts = allMembers;
|
||||
}
|
||||
|
@@ -20,8 +20,6 @@ import static java.util.stream.Collectors.toList;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
@@ -357,10 +355,9 @@ public class ReviewersUtil {
|
||||
|
||||
private List<GroupReference> suggestAccountGroups(
|
||||
SuggestReviewers suggestReviewers, ProjectState projectState) {
|
||||
return Lists.newArrayList(
|
||||
Iterables.limit(
|
||||
groupBackend.suggest(suggestReviewers.getQuery(), projectState),
|
||||
suggestReviewers.getLimit()));
|
||||
return groupBackend.suggest(suggestReviewers.getQuery(), projectState).stream()
|
||||
.limit(suggestReviewers.getLimit())
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private static class GroupAsReviewer {
|
||||
|
@@ -15,10 +15,10 @@
|
||||
package com.google.gerrit.server.restapi.group;
|
||||
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.google.gerrit.common.data.GroupDescription;
|
||||
@@ -320,10 +320,9 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
||||
"You should only have no more than one --project and -n with --suggest");
|
||||
}
|
||||
List<GroupReference> groupRefs =
|
||||
Lists.newArrayList(
|
||||
Iterables.limit(
|
||||
groupBackend.suggest(suggest, projects.stream().findFirst().orElse(null)),
|
||||
limit <= 0 ? 10 : Math.min(limit, 10)));
|
||||
groupBackend.suggest(suggest, projects.stream().findFirst().orElse(null)).stream()
|
||||
.limit(limit <= 0 ? 10 : Math.min(limit, 10))
|
||||
.collect(toList());
|
||||
|
||||
List<GroupInfo> groupInfos = Lists.newArrayListWithCapacity(groupRefs.size());
|
||||
for (GroupReference ref : groupRefs) {
|
||||
|
@@ -63,7 +63,7 @@ test $# -gt 0 || usage
|
||||
running() {
|
||||
test -f $1 || return 1
|
||||
PID=`cat $1`
|
||||
ps -o pid | grep -w $PID >/dev/null 2>/dev/null || return 1
|
||||
ps ax -o pid | grep -w $PID >/dev/null 2>/dev/null || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user