Skip to content

Commit

Permalink
filtering commits that have altered java code. r #60
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Pinto committed Sep 9, 2013
1 parent 35a9edf commit cd8c27f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@
*/
public class GitCommitExtractor {

/**
*
* @param project
* @return
* @throws IOException
*/
public List<Commit> extractCommits(File project) throws IOException {
public List<Commit> extractCommits(File project) {
CommitListFilter list = new CommitListFilter();

String path = project.getAbsolutePath() + "/.git";
Expand All @@ -49,6 +43,20 @@ public List<Commit> 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
Expand Down
2 changes: 1 addition & 1 deletion src/java/main/br/ufpe/cin/groundhog/main/TestMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit cd8c27f

Please sign in to comment.