|
@@ -144,17 +144,8 @@ public class BranchReviewServiceImpl implements BranchReviewService {
|
|
|
public void merge(int id) throws GitLabApiException, SeecoderGitlabException {
|
|
public void merge(int id) throws GitLabApiException, SeecoderGitlabException {
|
|
|
UserPO currentUser = UserService.loginUser();
|
|
UserPO currentUser = UserService.loginUser();
|
|
|
CodeReviewPO codeReviewPO = branchReviewMapper.selectById(id);
|
|
CodeReviewPO codeReviewPO = branchReviewMapper.selectById(id);
|
|
|
- String token;
|
|
|
|
|
- try{
|
|
|
|
|
- token = seecoderGitlabApi.getUserByUserNameNew(currentUser.getUsername()).getToken();
|
|
|
|
|
- } catch (SeecoderGitlabException exception) {
|
|
|
|
|
- throw new SeecoderGitlabException("500", "获取用户信息错误,可能是由于Gitlab账号与此账号名称不一致,请手动进行分支合并");
|
|
|
|
|
- }
|
|
|
|
|
- GitLabApi gitLabApi = new GitLabApi("https://seecoder-gitlab-gitlab.seec.seecoder.cn", token);
|
|
|
|
|
- MergeRequest mergeRequest = gitLabApi.getMergeRequestApi().createMergeRequest(codeReviewPO.getProjectId(), codeReviewPO.getSourceBranch(), codeReviewPO.getTargetBranch(),
|
|
|
|
|
|
|
+ seecoderGitlabApi.mergeBranch(codeReviewPO.getProjectId(), codeReviewPO.getSourceBranch(), codeReviewPO.getTargetBranch(),
|
|
|
codeReviewPO.getTitle(), codeReviewPO.getDescription(), codeReviewPO.getReviewerId());
|
|
codeReviewPO.getTitle(), codeReviewPO.getDescription(), codeReviewPO.getReviewerId());
|
|
|
- mergeRequest = gitLabApi.getMergeRequestApi().acceptMergeRequest(mergeRequest.getProjectId(), mergeRequest.getIid());
|
|
|
|
|
-
|
|
|
|
|
//数据库操作与对应的评论和消息创建
|
|
//数据库操作与对应的评论和消息创建
|
|
|
branchReviewMapper.merge(id);
|
|
branchReviewMapper.merge(id);
|
|
|
CodeReviewVO codeReviewVO = this.getById(id);
|
|
CodeReviewVO codeReviewVO = this.getById(id);
|