From bf77aff1ddb40853e1c5224a55124645f8ea4295 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Fri, 6 Jun 2025 08:25:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96dvc=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/NewDatasetServiceImpl.java | 17 ++++++++--------- .../java/com/ruoyi/platform/utils/DVCUtils.java | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java index 481bf03b..4256ec94 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java @@ -242,7 +242,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { ci4sUsername = Boolean.TRUE.equals(datasetVo.getIsPublic()) ? Constant.Item_Public : loginUser.getUsername(); Map 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> 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> 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(() -> { diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java index 819a5e53..d381764d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java @@ -478,7 +478,7 @@ public class DVCUtils { // 切换分支 gitCheckoutBranch(localPath, branch); -// dvcPull(localPath); + dvcPull(localPath); dvcCheckout(localPath); }