| @@ -537,6 +537,8 @@ public class DVCUtils { | |||||
| fetchCommand.setCredentialsProvider(credentialsProvider).call(); | fetchCommand.setCredentialsProvider(credentialsProvider).call(); | ||||
| } | } | ||||
| } | } | ||||
| //强制切换分支 | |||||
| public void gitCheckoutBranch(String localPath, String branchName) throws IOException, GitAPIException { | public void gitCheckoutBranch(String localPath, String branchName) throws IOException, GitAPIException { | ||||
| FileRepositoryBuilder builder = new FileRepositoryBuilder(); | FileRepositoryBuilder builder = new FileRepositoryBuilder(); | ||||
| Repository repository = builder.setGitDir(new File(localPath, ".git")) | Repository repository = builder.setGitDir(new File(localPath, ".git")) | ||||
| @@ -546,7 +548,7 @@ public class DVCUtils { | |||||
| try (Git git = new Git(repository)) { | try (Git git = new Git(repository)) { | ||||
| CheckoutCommand checkoutCommand = git.checkout(); | CheckoutCommand checkoutCommand = git.checkout(); | ||||
| checkoutCommand.setName(branchName).call(); | |||||
| checkoutCommand.setName(branchName).setForce(true).call(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -599,9 +601,9 @@ public class DVCUtils { | |||||
| runCommand(command, localPath); | runCommand(command, localPath); | ||||
| } | } | ||||
| // 更新的 dvcPull 方法 | |||||
| // 强制刷新 dvcPull 方法 | |||||
| public void dvcPull(String localPath) throws Exception { | public void dvcPull(String localPath) throws Exception { | ||||
| String command = "dvc pull -v"; | |||||
| String command = "dvc pull --force"; | |||||
| runCommand(command, localPath); | runCommand(command, localPath); | ||||
| } | } | ||||