| JGit statistics [message #754099] |
Mon, 31 October 2011 14:37  |
bugzilla Messages: 2 Registered: October 2011 |
Junior Member |
|
|
Hello,
I'm trying to gather some metrics from a git repository. Until now I was parsing the output of the git command, but I would like to have a complete Java implementation without any dependencies to installed programs.
I used this git command for parsing:
git log --shortstat --no-merges --pretty=format:"%H %at %an %ae"
I was able to gather the commits and the associated information like author etc. But how can I find out the lines of code that changed due to a commit? Is there a possibility to do this with JGit?
|
|
|
| Re: JGit statistics [message #754103 is a reply to message #754099] |
Mon, 31 October 2011 14:48   |
Kevin Sawicki Messages: 47 Registered: September 2011 |
Member |
|
|
Hi,
I wrote a library on top of JGit with filters to track commit statistics and inspect the differences introduced by each commit.
It is called gitective and is available on GitHub: github.com/kevinsawicki/gitective
It relies purely on JGit and has utilities for diff'ing blobs, creating tree walks, and generating histograms for changes introduced by commits.
The README has many examples of how it can be used.
[Updated on: Mon, 31 October 2011 14:50] Report message to a moderator
|
|
|
|
| Re: JGit statistics [message #754561 is a reply to message #754109] |
Thu, 03 November 2011 05:54  |
Kevin Sawicki Messages: 47 Registered: September 2011 |
Member |
|
|
You can extend the org.gitective.core.filter.commit.DiffCountFilter class and override the include(RevCommit commit, Collection<DiffEntry> diffs, int diffCount) method.
This method will be called on each commit visited with the collection of diffs as well as the total number of diffs introduced. You can return true or false if you want to continue the commit walk or stop it for each commit visited. Always returning true for every commit will keep the walk going until all commits have been processed in the repository.
|
|
|
Powered by
FUDForum. Page generated in 0.01530 seconds