diff --git a/RepositoryMinerForGit/src/main/java/Test.java b/RepositoryMinerForGit/src/main/java/Test.java index 04e3a0b..587c22b 100644 --- a/RepositoryMinerForGit/src/main/java/Test.java +++ b/RepositoryMinerForGit/src/main/java/Test.java @@ -1,7 +1,7 @@ import java.io.File; import java.io.IOException; import java.util.List; - + import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.InvalidRemoteException; @@ -24,26 +24,26 @@ import org.eclipse.jgit.storage.file.FileRepositoryBuilder; import org.eclipse.jgit.treewalk.CanonicalTreeParser; import org.eclipse.jgit.util.io.DisabledOutputStream; - + public class Test { - + public static void main(String[] args) { - + String amaryllis_server = "http://nitta-lab-www.is.konan-u.ac.jp/gitbucket/git/nitta-lab-2020/org.ntlab.amaryllis.server.git"; String acanthus_client = "http://nitta-lab-www.is.konan-u.ac.jp/gitbucket/git/nitta-lab-2021/org.ntlab.acanthus_client.git"; String acanthus_server = "http://nitta-lab-www.is.konan-u.ac.jp/gitbucket/git/nitta-lab-2021/org.ntlab.acanthus_server.git"; - + // TODO Auto-generated method stub try { Repository repo = new FileRepository( "./project/.git" ); Git git = new Git( repo ); - + if( git != null ){ //. git clone File project = new File( "./project" ); - + String filePath = "./project"; - + // フォルダの存在を確認する if (project.exists()) { System.out.println("projectフォルダが存在します"); @@ -51,7 +51,7 @@ } else { System.out.println("projectフォルダが存在しません"); } - + git.cloneRepository().setURI( acanthus_client ).setDirectory( project ).call(); } @@ -59,12 +59,12 @@ ObjectId rootId = repo.resolve("HEAD"); RevCommit root = revWalk.parseCommit(rootId); revWalk.markStart(root); - + // コミットコメント PlotCommitList plotCommitList = new PlotCommitList(); plotCommitList.source(revWalk); plotCommitList.fillTo(Integer.MAX_VALUE); - + for (PlotCommit c: plotCommitList) { // コミットメッセージ System.out.println("コミットメッセージ: " + c.getFullMessage()); @@ -81,14 +81,14 @@ df.setRepository(repo); df.setDiffComparator(RawTextComparator.DEFAULT); df.setDetectRenames(true); - + ObjectReader reader = repo.newObjectReader(); CanonicalTreeParser newTreeIter = new CanonicalTreeParser(); newTreeIter.reset(reader, curId); CanonicalTreeParser oldTreeIter = new CanonicalTreeParser(); oldTreeIter.reset(reader, parentId); List entries = df.scan( oldTreeIter, newTreeIter ); - + for( DiffEntry entry : entries ) { // ファイル毎の情報 System.out.println("パス: " + entry.getNewPath()); @@ -110,9 +110,9 @@ // TODO Auto-generated catch block e.printStackTrace(); } - + } - + public static void delete(String path) { File filePath = new File(path); String[] list = filePath.list(); @@ -126,5 +126,5 @@ } filePath.delete(); } - + }