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 { ...@@ -481,17 +481,8 @@ public class GitlabAPI {
} }
public List<GitlabMergeRequest> getOpenMergeRequests(GitlabProject project) throws IOException { public List<GitlabMergeRequest> getOpenMergeRequests(GitlabProject project) throws IOException {
List<GitlabMergeRequest> allMergeRequests = getAllMergeRequests(project); String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabMergeRequest.URL + "?state=opened";
List<GitlabMergeRequest> openMergeRequests = new ArrayList<GitlabMergeRequest>(); return retrieve().getAll(tailUrl, GitlabMergeRequest[].class);
for (GitlabMergeRequest mergeRequest : allMergeRequests) {
if (mergeRequest.isMerged() || mergeRequest.isClosed()) {
continue;
}
openMergeRequests.add(mergeRequest);
}
return openMergeRequests;
} }
public List<GitlabMergeRequest> getMergeRequests(Serializable projectId) throws IOException { 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