|
|
@@ -13,6 +13,7 @@ import com.nju.edu.gitlab.vo.VisibilityVO;
|
|
|
import com.nju.edu.gitlab.vo.commit.CommitStatsVO;
|
|
|
import com.nju.edu.gitlab.vo.commit.CommitVO;
|
|
|
import com.nju.edu.gitlab.vo.DiffVO;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.gitlab4j.api.*;
|
|
|
import org.gitlab4j.api.models.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -24,6 +25,7 @@ import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Component
|
|
|
+@Slf4j
|
|
|
public class ProjectServiceImpl implements ProjectService {
|
|
|
private final GitLabApi gitlabApi;
|
|
|
private final GitlabUserRepository gitlabUserRepository;
|
|
|
@@ -83,6 +85,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|
|
GitlabUser gitlabUser = getGitlabUser(userId);
|
|
|
Integer namespaceId=gitlabUser.getNamespaceId();
|
|
|
Project project;
|
|
|
+ log.info("trying to fork project {} to user {} (whose gitlab id is {})", projectId, userId, gitlabUser.getGitlabUserId());
|
|
|
try{
|
|
|
gitlabApi.setSudoAsId(gitlabUser.getGitlabUserId());
|
|
|
project=gitlabApi.getProjectApi().forkProject(projectId,namespaceId);
|
|
|
@@ -100,6 +103,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|
|
int groupId=groupForkDTO.getGroupId();
|
|
|
int projectId=groupForkDTO.getProjectId();
|
|
|
Integer namespaceId=fetchGroupNameSpaceId(gitlabApi.getGroupApi().getGroup(groupId).getName());
|
|
|
+ log.info("trying to fork project {} to group {} (whose gitlab namespace id is {})", projectId, groupId, namespaceId);
|
|
|
if (namespaceId == null)
|
|
|
throw new NullPointerException();
|
|
|
Project project;
|