|
|
@ -10,7 +10,6 @@ import org.eclipse.jgit.api.errors.GitAPIException;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import ru.ulstu.extractor.model.Branch;
|
|
|
|
import ru.ulstu.extractor.model.Branch;
|
|
|
|
import ru.ulstu.extractor.model.Commit;
|
|
|
|
import ru.ulstu.extractor.model.Commit;
|
|
|
|
import ru.ulstu.extractor.model.Repository;
|
|
|
|
import ru.ulstu.extractor.model.Repository;
|
|
|
@ -36,7 +35,6 @@ public class IndexService {
|
|
|
|
this.branchService = branchService;
|
|
|
|
this.branchService = branchService;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
|
|
|
public void index(@NotNull String repositoryUrl, @NotNull String branchName) throws GitAPIException, IOException {
|
|
|
|
public void index(@NotNull String repositoryUrl, @NotNull String branchName) throws GitAPIException, IOException {
|
|
|
|
Repository repository = repositoryRepository.findByUrl(repositoryUrl);
|
|
|
|
Repository repository = repositoryRepository.findByUrl(repositoryUrl);
|
|
|
|
if (repository == null) {
|
|
|
|
if (repository == null) {
|
|
|
@ -52,7 +50,7 @@ public class IndexService {
|
|
|
|
List<Commit> commits = gitRepositoryService.getCommits(repositoryUrl, branchName, commitsFrom, commitsTo, true);
|
|
|
|
List<Commit> commits = gitRepositoryService.getCommits(repositoryUrl, branchName, commitsFrom, commitsTo, true);
|
|
|
|
while (!commits.isEmpty()) {
|
|
|
|
while (!commits.isEmpty()) {
|
|
|
|
LOG.debug("{} commits loaded.", commits.size());
|
|
|
|
LOG.debug("{} commits loaded.", commits.size());
|
|
|
|
branch = branchService.addCommits(branch, commits);
|
|
|
|
branchService.addCommits(branch, commits);
|
|
|
|
LOG.debug("{} commits successfully saved. {} {}", commits.size(), repositoryUrl, branchName);
|
|
|
|
LOG.debug("{} commits successfully saved. {} {}", commits.size(), repositoryUrl, branchName);
|
|
|
|
commitsFrom += COMMITS_PAGE_SIZE;
|
|
|
|
commitsFrom += COMMITS_PAGE_SIZE;
|
|
|
|
commitsTo += COMMITS_PAGE_SIZE;
|
|
|
|
commitsTo += COMMITS_PAGE_SIZE;
|
|
|
|