|
|
@@ -303,7 +303,7 @@ public class DVCUtils { |
|
|
.call(); |
|
|
.call(); |
|
|
log.info("基于 master 的远程分支 " + branchName + " 创建成功。"); |
|
|
log.info("基于 master 的远程分支 " + branchName + " 创建成功。"); |
|
|
} catch (IOException | GitAPIException e) { |
|
|
} catch (IOException | GitAPIException e) { |
|
|
log.error("Exception occurred while creating local branch based on master",e); |
|
|
|
|
|
|
|
|
log.error("Exception occurred while creating local branch based on master", e); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -378,17 +378,17 @@ public class DVCUtils { |
|
|
.call(); |
|
|
.call(); |
|
|
|
|
|
|
|
|
// 打印结果 |
|
|
// 打印结果 |
|
|
pushResults.forEach(pr ->log.info(pr.getMessages())); |
|
|
|
|
|
|
|
|
pushResults.forEach(pr -> log.info(pr.getMessages())); |
|
|
|
|
|
|
|
|
log.info("分支 " + branchName + " 已成功推送到远程仓库。"); |
|
|
|
|
|
|
|
|
log.info("分支 " + branchName + " 已成功推送到远程仓库。"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 检查本地是否存在指定分支 |
|
|
* 检查本地是否存在指定分支 |
|
|
* |
|
|
* |
|
|
* @param git Git 实例 |
|
|
|
|
|
* @param branchName 分支名称 |
|
|
|
|
|
|
|
|
* @param git Git 实例 |
|
|
|
|
|
* @param branchName 分支名称 |
|
|
* @return 如果本地存在该分支返回 true,否则返回 false |
|
|
* @return 如果本地存在该分支返回 true,否则返回 false |
|
|
*/ |
|
|
*/ |
|
|
private static boolean branchExistsLocally(Git git, String branchName) throws GitAPIException { |
|
|
private static boolean branchExistsLocally(Git git, String branchName) throws GitAPIException { |
|
|
@@ -524,7 +524,7 @@ public class DVCUtils { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void gitFetch(String localPath, String username, String password) throws IOException, GitAPIException { |
|
|
public void gitFetch(String localPath, String username, String password) 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")) |
|
|
@@ -624,12 +624,12 @@ public class DVCUtils { |
|
|
* @param branch 分支名称 |
|
|
* @param branch 分支名称 |
|
|
* @return 包含文件路径、名称和大小的List<Map<String, Object>> |
|
|
* @return 包含文件路径、名称和大小的List<Map<String, Object>> |
|
|
*/ |
|
|
*/ |
|
|
public List<Map<String, Object>> getFileDetailsAfterGitPull(String localPath, String repoFolder, String branch, String filePath , String username, String password) { |
|
|
|
|
|
|
|
|
public List<Map<String, Object>> getFileDetailsAfterGitPull(String localPath, String repoFolder, String branch, String filePath, String username, String password) { |
|
|
try { |
|
|
try { |
|
|
//刷新 |
|
|
//刷新 |
|
|
refreshRemoteBranches(localPath+"/" + repoFolder + "/"+ branch, username, password,branch); |
|
|
|
|
|
|
|
|
refreshRemoteBranches(localPath + "/" + repoFolder + "/" + branch, username, password, branch); |
|
|
// 读取data文件夹中的文件列表 |
|
|
// 读取data文件夹中的文件列表 |
|
|
String path = localPath + "/" + repoFolder + "/"+ branch + "/" + filePath; |
|
|
|
|
|
|
|
|
String path = localPath + "/" + repoFolder + "/" + branch + "/" + filePath; |
|
|
|
|
|
|
|
|
return FileUtil.getFiles(path); |
|
|
return FileUtil.getFiles(path); |
|
|
|
|
|
|
|
|
|