Skip to content

Commit

Permalink
pr: remove commitCommandUsers
Browse files Browse the repository at this point in the history
Reviewed-by: rwestberg, ihse
  • Loading branch information
edvbld committed Feb 15, 2021
1 parent 3cf5bd0 commit 8077766
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 37 deletions.
Expand Up @@ -57,7 +57,6 @@ class PullRequestBot implements Bot {
private final String confOverrideName;
private final String confOverrideRef;
private final String censusLink;
private final Set<String> commitCommandUsers;
private final Set<String> autoLabelled;
private final ConcurrentHashMap<String, Instant> scheduledRechecks;
private final PullRequestUpdateCache updateCache;
Expand All @@ -74,8 +73,7 @@ class PullRequestBot implements Bot {
Map<String, Pattern> readyComments, IssueProject issueProject,
boolean ignoreStaleReviews, Pattern allowedTargetBranches,
Path seedStorage, HostedRepository confOverrideRepo, String confOverrideName,
String confOverrideRef, String censusLink, List<HostUser> commitCommandUsers,
Map<String, HostedRepository> forks) {
String confOverrideRef, String censusLink, Map<String, HostedRepository> forks) {
remoteRepo = repo;
this.censusRepo = censusRepo;
this.censusRef = censusRef;
Expand All @@ -95,9 +93,6 @@ class PullRequestBot implements Bot {
this.confOverrideRef = confOverrideRef;
this.censusLink = censusLink;

this.commitCommandUsers = commitCommandUsers.stream()
.map(HostUser::id)
.collect(Collectors.toSet());
this.forks = forks;

autoLabelled = new HashSet<>();
Expand Down Expand Up @@ -196,16 +191,13 @@ public List<WorkItem> getPeriodicItems() {
prs = remoteRepo.pullRequests(ZonedDateTime.now().minus(Duration.ofDays(1)));
}

if (!commitCommandUsers.isEmpty()) {
commitComments = remoteRepo.recentCommitComments().stream()
.filter(cc -> !processedCommitComments.contains(cc.id()))
.filter(cc -> commitCommandUsers.contains(cc.author().id()))
.collect(Collectors.toList());
if (!commitComments.isEmpty()) {
processedCommitComments.addAll(commitComments.stream()
.map(Comment::id)
.collect(Collectors.toList()));
}
commitComments = remoteRepo.recentCommitComments().stream()
.filter(cc -> !processedCommitComments.contains(cc.id()))
.collect(Collectors.toList());
if (!commitComments.isEmpty()) {
processedCommitComments.addAll(commitComments.stream()
.map(Comment::id)
.collect(Collectors.toList()));
}

return getWorkItems(prs, commitComments);
Expand Down
Expand Up @@ -51,7 +51,6 @@ public class PullRequestBotBuilder {
private String confOverrideName = ".conf/jcheck";
private String confOverrideRef = Branch.defaultFor(VCS.GIT).name();
private String censusLink = null;
private List<HostUser> commitCommandUsers = List.of();
private Map<String, HostedRepository> forks = Map.of();

PullRequestBotBuilder() {
Expand Down Expand Up @@ -147,11 +146,6 @@ public PullRequestBotBuilder censusLink(String censusLink) {
return this;
}

public PullRequestBotBuilder commitCommandUsers(List<HostUser> commitCommandUsers) {
this.commitCommandUsers = commitCommandUsers;
return this;
}

public PullRequestBotBuilder forks(Map<String, HostedRepository> forks) {
this.forks = forks;
return this;
Expand All @@ -162,6 +156,6 @@ public PullRequestBot build() {
blockingCheckLabels, readyLabels, twoReviewersLabels, twentyFourHoursLabels,
readyComments, issueProject, ignoreStaleReviews,
allowedTargetBranches, seedStorage, confOverrideRepo, confOverrideName,
confOverrideRef, censusLink, commitCommandUsers, forks);
confOverrideRef, censusLink, forks);
}
}
Expand Up @@ -141,14 +141,6 @@ public List<Bot> create(BotConfiguration configuration) {
botBuilder.censusLink(repo.value().get("censuslink").asString());
}

if (repo.value().contains("commitcommanders")) {
var allowed = repo.value().get("commitcommanders").stream()
.map(JSONValue::asString)
.map(s -> HostUser.builder().id(s).build())
.collect(Collectors.toList());
botBuilder.commitCommandUsers(allowed);
}

ret.add(botBuilder.build());
}

Expand Down
Expand Up @@ -47,7 +47,6 @@ void simple(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

Expand Down Expand Up @@ -115,7 +114,6 @@ void unknownTargetRepo(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

Expand Down Expand Up @@ -157,7 +155,6 @@ void unknownTargetBranch(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

Expand Down Expand Up @@ -199,7 +196,6 @@ void backportDoesNotApply(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.forks(Map.of(author.name(), author))
.build();

Expand Down
Expand Up @@ -46,7 +46,6 @@ void simple(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.build();

// Populate the projects repository
Expand Down Expand Up @@ -92,7 +91,6 @@ void simplePullRequest(TestInfo testInfo) throws IOException {
.censusRepo(censusBuilder.build())
.censusLink("https://census.com/{{contributor}}-profile")
.seedStorage(seedFolder)
.commitCommandUsers(List.of(author.forge().currentUser()))
.build();

// Populate the projects repository
Expand Down

1 comment on commit 8077766

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.