-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kimseokjin
committed
Jan 28, 2020
1 parent
1e8d589
commit 6c57df5
Showing
4 changed files
with
125 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
arguments= | ||
auto.sync=false | ||
build.scans.enabled=false | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||
connection.project.dir= | ||
eclipse.preferences.version=1 | ||
gradle.user.home= | ||
java.home= | ||
jvm.arguments= | ||
offline.mode=false | ||
override.workspace.settings=true | ||
show.console.view=true | ||
show.executions.view=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package hgu.csee.isel.alinew.szz; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
import org.eclipse.jgit.api.Git; | ||
import org.eclipse.jgit.api.errors.GitAPIException; | ||
import org.eclipse.jgit.api.errors.NoHeadException; | ||
import org.eclipse.jgit.errors.CorruptObjectException; | ||
import org.eclipse.jgit.errors.IncorrectObjectTypeException; | ||
import org.eclipse.jgit.errors.MissingObjectException; | ||
import org.eclipse.jgit.lib.Repository; | ||
import org.eclipse.jgit.revwalk.RevCommit; | ||
import org.eclipse.jgit.revwalk.RevTree; | ||
import org.eclipse.jgit.treewalk.TreeWalk; | ||
import org.eclipse.jgit.treewalk.filter.PathSuffixFilter; | ||
|
||
import hgu.csee.isel.alinew.szz.model.RevsInPath; | ||
|
||
public class AgSZZ { | ||
private final String GIT_DIR = "/Users/kimseokjin/git/PLOP2"; | ||
//private final String FIX_COMMIT = "768b0df07b2722db926e99a8f917deeb5b55d628"; | ||
|
||
private static Git git; | ||
private Repository repo; | ||
|
||
public static void main(String[] args) { | ||
new AgSZZ().run(); | ||
} | ||
|
||
private void run() { | ||
try { | ||
git = Git.open(new File(GIT_DIR)); | ||
repo = git.getRepository(); | ||
|
||
List<RevCommit> commits = getCommits(git); | ||
|
||
// TODO make RevsInPath | ||
RevsInPath revsInPath = configureRevsInPath(repo, commits); | ||
|
||
|
||
|
||
} catch (IOException e) { | ||
|
||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private RevsInPath configureRevsInPath(Repository repo, List<RevCommit> commits) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { | ||
RevsInPath revsInPath = new RevsInPath(); | ||
|
||
for(RevCommit commit : commits) { | ||
List<String> paths = new ArrayList<>(); | ||
RevTree tree = commit.getTree(); | ||
|
||
TreeWalk treeWalk = new TreeWalk(repo); | ||
treeWalk.addTree(tree); | ||
treeWalk.setRecursive(true); | ||
treeWalk.setFilter(PathSuffixFilter.create(".java")); | ||
|
||
//TEST | ||
System.out.println("\nRev : " + commit.getName() + "\n"); | ||
|
||
while(treeWalk.next()) { | ||
String path = treeWalk.getPathString(); | ||
|
||
//TEST | ||
System.out.println("found: " + path); | ||
|
||
paths.add(path); | ||
|
||
|
||
|
||
} | ||
|
||
//put | ||
} | ||
|
||
return revsInPath; | ||
} | ||
|
||
private List<RevCommit> getCommits(Git git) { | ||
List<RevCommit> commits = new ArrayList<>(); | ||
|
||
Iterable<RevCommit> logs; | ||
|
||
try { | ||
logs = git.log().call(); | ||
|
||
for(RevCommit rev:logs) { | ||
commits.add(rev); | ||
} | ||
} catch (GitAPIException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
|
||
return commits; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/main/java/hgu/csee/isel/alinew/szz/model/RevsInPath.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package hgu.csee.isel.alinew.szz.model; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import org.eclipse.jgit.revwalk.RevCommit; | ||
|
||
public class RevsInPath extends HashMap<String, List<RevCommit>>{ | ||
|
||
} |