Commit 9439ec7e authored by Kasper Fock's avatar Kasper Fock

Changed getOpenMergeRequests to only retrieve the open merge requests instead...

Changed getOpenMergeRequests to only retrieve the open merge requests instead of retrieving all and filtering client side. This will speedup especially old projects with lots of merge requests.
parent bd680583
......@@ -481,17 +481,8 @@ public class GitlabAPI {
}
public List<GitlabMergeRequest> getOpenMergeRequests(GitlabProject project) throws IOException {
List<GitlabMergeRequest> allMergeRequests = getAllMergeRequests(project);
List<GitlabMergeRequest> openMergeRequests = new ArrayList<GitlabMergeRequest>();
for (GitlabMergeRequest mergeRequest : allMergeRequests) {
if (mergeRequest.isMerged() || mergeRequest.isClosed()) {
continue;
}
openMergeRequests.add(mergeRequest);
}
return openMergeRequests;
String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabMergeRequest.URL + "?state=opened";
return retrieve().getAll(tailUrl, GitlabMergeRequest[].class);
}
public List<GitlabMergeRequest> getMergeRequests(Serializable projectId) throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment