Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » JGit statistics
JGit statistics [message #754099] Mon, 31 October 2011 14:37 Go to next message
bugzilla is currently offline 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 Go to previous messageGo to next message
Kevin Sawicki is currently offline 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 #754109 is a reply to message #754103] Mon, 31 October 2011 15:47 Go to previous messageGo to next message
bugzilla is currently offline bugzilla
Messages: 2
Registered: October 2011
Junior Member
Thank you for your help, I included gitective in my program and it works just fine. I read the README, but I could not find any information about how I can find the lines of code that were changed in a commit. Is there already a possibility to collect this information?
Re: JGit statistics [message #754561 is a reply to message #754109] Thu, 03 November 2011 05:54 Go to previous message
Kevin Sawicki is currently offline 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.
Previous Topic:Maven Repository not available
Next Topic:Zend Studio 8 text compare
Goto Forum:
  


Current Time: Tue Jul 22 19:44:54 EDT 2014

Powered by FUDForum. Page generated in 0.02246 seconds