Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default value for filter #400

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ protected void retrieve(
if (request.isFetchBranches()) {
request.setBranches(gitLabApi.getRepositoryApi().getBranches(gitlabProject));
}
Predicate<MergeRequest> filter = ignore -> false;
Predicate<MergeRequest> includeWorkInProgress = mr -> true;
Copy link
Member

Choose a reason for hiding this comment

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

I have another approach, I'll send a PR shortly, chose to rewrite it as I found the logic confusing.

Copy link
Member

Choose a reason for hiding this comment

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

Created #403

if (ctx.alwaysIgnoreMRWorkInProgress()) {
filter = mr -> !mr.getWorkInProgress();
includeWorkInProgress = mr -> !mr.getWorkInProgress();
}
if (request.isFetchMRs() && gitlabProject.getMergeRequestsEnabled()) {
// If not authenticated GitLabApi cannot detect if it is a fork
Expand All @@ -347,7 +347,7 @@ protected void retrieve(
.getMergeRequests(gitlabProject, Constants.MergeRequestState.OPENED);
mrs = mrs.stream()
.filter(mr -> mr.getSourceProjectId() != null)
.filter(filter)
.filter(includeWorkInProgress)
.collect(Collectors.toList());
request.setMergeRequests(mrs);
} else if (ctx.buildMRForksNotMirror()) {
Expand All @@ -362,7 +362,7 @@ protected void retrieve(
.equals(gitlabProject
.getForkedFromProject()
.getId()))
.filter(filter)
.filter(includeWorkInProgress)
.collect(Collectors.toList());
request.setMergeRequests(mrs);
} else {
Expand Down