I'm having problems with CommitTimeRevFilter [message #1577112] |
Wed, 21 January 2015 18:18 |
Kevin North 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)
|
|
|
Powered by
FUDForum. Page generated in 0.03051 seconds