diff --git a/src/java/main/br/ufpe/cin/groundhog/extractor/GitCommitExtractor.java b/src/java/main/br/ufpe/cin/groundhog/extractor/GitCommitExtractor.java index ca31240..9d9c654 100644 --- a/src/java/main/br/ufpe/cin/groundhog/extractor/GitCommitExtractor.java +++ b/src/java/main/br/ufpe/cin/groundhog/extractor/GitCommitExtractor.java @@ -26,13 +26,7 @@ */ public class GitCommitExtractor { - /** - * - * @param project - * @return - * @throws IOException - */ - public List extractCommits(File project) throws IOException { + public List extractCommits(File project) { CommitListFilter list = new CommitListFilter(); String path = project.getAbsolutePath() + "/.git"; @@ -49,6 +43,20 @@ public List extractCommits(File project) throws IOException { return null; } + public int numberOfCommits(File project) { + CommitCountFilter commits = new CommitCountFilter(); + String path = project.getAbsolutePath() + "/.git"; + + CommitFinder finder = new CommitFinder(path); + finder.setFilter(PathFilterUtils.andSuffix(".java")); + finder.setMatcher(commits); + finder.find(); + + System.out.println(commits.getCount()); + + return (int) commits.getCount(); + } + /** * Extracts only the commits from a given {@link User} * TODO: implement this method diff --git a/src/java/main/br/ufpe/cin/groundhog/main/TestMain.java b/src/java/main/br/ufpe/cin/groundhog/main/TestMain.java index bec24af..88acf80 100644 --- a/src/java/main/br/ufpe/cin/groundhog/main/TestMain.java +++ b/src/java/main/br/ufpe/cin/groundhog/main/TestMain.java @@ -14,7 +14,6 @@ import br.ufpe.cin.groundhog.Project; import br.ufpe.cin.groundhog.SCM; -import br.ufpe.cin.groundhog.User; import br.ufpe.cin.groundhog.codehistory.CodeHistoryModule; import br.ufpe.cin.groundhog.codehistory.GitCodeHistory; import br.ufpe.cin.groundhog.codehistory.SFCodeHistory; @@ -198,6 +197,7 @@ public static void main(String[] args) throws Exception { GitCommitExtractor extractor = new GitCommitExtractor(); extractor.extractCommits(project); + extractor.numberOfCommits(project); System.out.println("Pronto!"); // sourceForgeExample();