Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev-DXTZYK
chenzhihang 1 year ago
parent
commit
632de0748e
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/DVCUtils.java

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

@@ -537,6 +537,8 @@ public class DVCUtils {
fetchCommand.setCredentialsProvider(credentialsProvider).call();
}
}

//强制切换分支
public void gitCheckoutBranch(String localPath, String branchName) throws IOException, GitAPIException {
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repository = builder.setGitDir(new File(localPath, ".git"))
@@ -546,7 +548,7 @@ public class DVCUtils {

try (Git git = new Git(repository)) {
CheckoutCommand checkoutCommand = git.checkout();
checkoutCommand.setName(branchName).call();
checkoutCommand.setName(branchName).setForce(true).call();
}
}

@@ -599,9 +601,9 @@ public class DVCUtils {
runCommand(command, localPath);
}

// 更新的 dvcPull 方法
// 强制刷新 dvcPull 方法
public void dvcPull(String localPath) throws Exception {
String command = "dvc pull -v";
String command = "dvc pull --force";
runCommand(command, localPath);
}



Loading…
Cancel
Save