Browse Source

优化dvc测试

dev-check
chenzhihang 10 months ago
parent
commit
bf77aff1dd
2 changed files with 9 additions and 10 deletions
  1. +8
    -9
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java

+ 8
- 9
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java View File

@@ -242,7 +242,7 @@ public class NewDatasetServiceImpl implements NewDatasetService {
ci4sUsername = Boolean.TRUE.equals(datasetVo.getIsPublic()) ? Constant.Item_Public : loginUser.getUsername();
Map<String, Object> userInfo = JsonUtils.jsonToMap(userReq);
// 创建分支
String branchName = StringUtils.isEmpty(datasetVo.getVersion()) ? "master" : datasetVo.getVersion();
String branchName = datasetVo.getVersion();
String owner = (String) userInfo.get("login");

String repositoryName = datasetVo.getIdentifier();
@@ -260,20 +260,20 @@ public class NewDatasetServiceImpl implements NewDatasetService {
Map projectDetail = gitService.getProjectDetail(owner, repositoryName, token);

//克隆
List<Map<String, Object>> brancheList = gitService.getBrancheList(token, owner, repositoryName);
String oldBranch = (String) brancheList.stream()
.filter(branch -> !"master".equals(branch.get("name"))).collect(Collectors.toList()).get(0).get("name");
// List<Map<String, Object>> brancheList = gitService.getBrancheList(token, owner, repositoryName);
// String oldBranch = (String) brancheList.stream()
// .filter(branch -> !"master".equals(branch.get("name"))).collect(Collectors.toList()).get(0).get("name");

dvcUtils.gitClone(localPath, projectUrl, oldBranch, gitLinkUsername, gitLinkPassword);
dvcUtils.refreshRemoteBranches(localPath, gitLinkUsername, gitLinkPassword, oldBranch);
dvcUtils.gitClone(localPath, projectUrl, "master", gitLinkUsername, gitLinkPassword);
dvcUtils.refreshRemoteBranches(localPath, gitLinkUsername, gitLinkPassword, "master");

//检查是否存在本地重名分支,有的话
//检查是否存在本地重名分支,有的话
dvcUtils.deleteLocalBranch(localPath, branchName);
// 创建本地分支
dvcUtils.createLocalBranchBasedOnMaster(localPath, branchName);

//dvc checkout
// dvcUtils.dvcPull(localPath);
dvcUtils.dvcPull(localPath);
dvcUtils.dvcCheckout(localPath);

// 准备数据
@@ -330,7 +330,6 @@ public class NewDatasetServiceImpl implements NewDatasetService {
// dvc 跟踪
dvcUtils.dvcAdd(localPath, "dataset");
dvcUtils.pushNewBranchToRemote(localPath, gitLinkUsername, gitLinkPassword, branchName);

dvcUtils.dvcPush(localPath);

// CompletableFuture.supplyAsync(() -> {


+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java View File

@@ -478,7 +478,7 @@ public class DVCUtils {

// 切换分支
gitCheckoutBranch(localPath, branch);
// dvcPull(localPath);
dvcPull(localPath);
dvcCheckout(localPath);
}



Loading…
Cancel
Save