|
|
|
@ -41,6 +41,7 @@ public class BranchService {
|
|
|
|
|
@Transactional
|
|
|
|
|
public Branch save(Branch branch, List<Commit> commits) {
|
|
|
|
|
LOG.debug("Start save {} branch with {} commits ", branch.getName(), commits.size());
|
|
|
|
|
LOG.debug("Current branch contains {} commits ", branch.getCommits().size());
|
|
|
|
|
List<Integer> commitsToRemoveIds = branch.getCommits().stream().map(BaseEntity::getId).collect(Collectors.toList());
|
|
|
|
|
branch.setCommits(commitService.save(commits));
|
|
|
|
|
LOG.debug("Save branch {} ", branch.getName());
|
|
|
|
@ -50,12 +51,12 @@ public class BranchService {
|
|
|
|
|
return branch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
public Branch addCommits(Branch branch, List<Commit> commits) {
|
|
|
|
|
LOG.debug("Start add commits to {} branch with {} commits ", branch.getName(), commits.size());
|
|
|
|
|
commitService.save(commits);
|
|
|
|
|
branch.getCommits().addAll(commitService.save(commits));
|
|
|
|
|
LOG.debug("Save branch {} ", branch.getName());
|
|
|
|
|
commitService.updateBranchId(commits, branch.getId());
|
|
|
|
|
return branch;
|
|
|
|
|
return save(branch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Branch findByRepositoryAndName(GitRepository gitRepository, String branchName) {
|
|
|
|
|