Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » JGit statistics
JGit statistics [message #754099] Mon, 31 October 2011 18:37 Go to next message
bugzilla is currently offline bugzillaFriend
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 18:48 Go to previous messageGo to next message
Kevin Sawicki is currently offline Kevin SawickiFriend
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 18:50]

Report message to a moderator

Re: JGit statistics [message #754109 is a reply to message #754103] Mon, 31 October 2011 19:47 Go to previous messageGo to next message
bugzilla is currently offline bugzillaFriend
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 09:54 Go to previous message
Kevin Sawicki is currently offline Kevin SawickiFriend
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 Mar 19 04:58:25 GMT 2024

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

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

Back to the top