use of com.atlassian.stash.repository.RepositoryBranchesRequest in project stash-codesearch-plugin by palantir.
the class RepositoryServiceManagerImpl method getBranchMap.
@Override
public ImmutableMap<String, Branch> getBranchMap(Repository repository) {
PageRequest req = new PageRequestImpl(0, PAGE_SIZE);
Map<String, Branch> branchMap = new HashMap<String, Branch>();
RepositoryBranchesRequest rbr = new RepositoryBranchesRequest.Builder().repository(repository).order(RefOrder.ALPHABETICAL).build();
while (true) {
Page<? extends Branch> branchPage = repositoryMetadataService.getBranches(rbr, req);
for (Branch b : branchPage.getValues()) {
if (branchMap.containsKey(b)) {
log.error("Tryting to insert existing key '" + b.getId() + "' into branchMap with value '" + b + "'");
continue;
}
branchMap.put(b.getId(), b);
}
if (branchPage.getIsLastPage()) {
break;
}
req = branchPage.getNextPageRequest();
}
return ImmutableMap.copyOf(branchMap);
}
Aggregations