From 04981591bf998293b268572d79034c6a82c9dd84 Mon Sep 17 00:00:00 2001 From: xyli Date: Fri, 3 Mar 2023 11:22:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95Git?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/git/TestGit.java | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/test/java/git/TestGit.java b/src/test/java/git/TestGit.java index 697641b..429cdab 100644 --- a/src/test/java/git/TestGit.java +++ b/src/test/java/git/TestGit.java @@ -51,4 +51,47 @@ // Files.delete(path); // } // +// +// public static void main(String[] args) throws GitAPIException, IOException, URISyntaxException { +// +// Git git = Git.init().setDirectory(new File("D:\\tttt")).call(); +// RemoteConfig remoteConfig = Git.open(new File("D:\\tttt")).remoteAdd().setUri(new URIish("https://gitee.com/keepbx/Jpom.git")).call(); +// System.out.println(remoteConfig); +// +// List call = git.remoteList().call(); +// System.out.println(call); +// git.pull().call(); +// List list = git.branchList().setListMode(ListBranchCommand.ListMode.REMOTE).call(); +// List all = new ArrayList<>(list.size()); +// list.forEach(ref -> { +// String name = ref.getName(); +// if (name.startsWith(Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME)) { +// all.add(name.substring((Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME).length() + 1)); +// } +// }); +// System.out.println(all); +// } +// +// +// @Test +// public void testTag() throws Exception { +// String uri = "https://gitee.com/dromara/Jpom.git"; +// File file = FileUtil.file("~/test/jpomgit"); +// String tagName = "v2.5.2"; +// String branchName = "stand-alone"; +// +// PrintWriter printWriter = new PrintWriter(System.out); +// RepositoryModel repositoryModel = new RepositoryModel(); +// repositoryModel.setGitUrl(uri); +// repositoryModel.setRepoType(RepositoryModel.RepoType.Git.getCode()); +// repositoryModel.setUserName("a"); +// repositoryModel.setPassword("a"); +// repositoryModel.setProtocol(GitProtocolEnum.HTTP.getCode()); +// +// GitUtil.checkoutPullTag(repositoryModel, file, branchName, tagName, printWriter); +// +// } +// +// +// //} -- Gitee