Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » I'm having problems with CommitTimeRevFilter
I'm having problems with CommitTimeRevFilter [message #1577112] Wed, 21 January 2015 18:18
Kevin North is currently offline Kevin NorthFriend
Messages: 1
Registered: January 2015
Junior Member
I'm using jGit to walk over the commits in a repository. When I use the RevWalk class by itself, I get back all of the commits in the repository. When I use revWalk.setFilter() to add a filter, though, I no longer get any commits whatsoever, even though I know for sure that commits exist that match my filter's criteria.

Here is my code:

   RevWalk walk = new RevWalk(repo);
   // These two lines give me trouble:
   // RevFilter filter = CommitTimeRevFilter.between(sinceDate, untilDate);
   // walk.setRevFilter(filter);

    Ref head = repo.getRef("refs/heads/master");
    RevCommit headCommit = walk.parseCommit(head.getObjectId());
    // omitting some exception handling for conciseness
    walk.markStart(headCommit);

    List<MyCommitPOCO> commits  = new LinkedList<>();

    for(RevCommit commit : walk) {
        MyCommitPOCO processedCommit = processRevCommit(commit);
        commits.add(processedCommit);
    }

    walk.dispose();

    return commits;


When I run this code without the two lines that are commented out at the top, the for loop iterating over walk's commits processes every commit in my repository, which I expected. When I uncomment the lines with the RevFilter, however, the for loop does not iterate over even a single commit, which doesn't seem right to me. I've tried running the program with multiple values for sinceDate and untilDate that I know are appropriate for the repository I'm trying to work with, but none of the attempts I've made have worked.

Why isn't my RevWalk letting me iterate over any commits when I use a RevFilter with it? What's wrong with the two lines of code that cause the problem when I uncomment them?

(I have also posted this question on StackOverflow: stackoverflow.com/questions/28056917/when-i-use-a-revfilter-my-revwalk-isnt-selecting-any-commits)
Previous Topic:"Replace with Index" and "Replace with HEAD" in Staging view do nothing
Next Topic:can NOT install EGit because of m2e - Maven
Goto Forum:
  


Current Time: Wed Apr 01 11:59:27 GMT 2020

Powered by FUDForum. Page generated in 0.01759 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top