Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Getting diff from two repositories in jGit
Getting diff from two repositories in jGit [message #896584] Thu, 19 July 2012 01:34 Go to next message
Thomas Shippey is currently offline Thomas ShippeyFriend
Messages: 2
Registered: July 2012
Location: London, UK
Junior Member

Hi

I have searching on the net for a while now trying to find a step in the right direction, but I am having no luck!

I am in the process of creating a program that is searching for possible defects within a software system. To do this we search the log files to find certain pointers to revision that contain 'bug fixes' (i.e. the commit message has a bug id number). When we find a possible 'big fix' we need to extract the code from the repository that could have been fixed. To do this we diff that revision to the one previously before it.

I know in cmd the code is git diff rev rev^. However I can not seem to replicate this in JGit. Does anyone know how this is achieved, or can point me in the right direction? I do have the code below so far is this right?

DiffCommand diff = git.diff();
ByteArrayOutputStream out = new ByteArrayOutputStream();
DiffFormatter df = new DiffFormatter(out);
FileTreeIterator oldTree = new FileTreeIterator(repo);
FileTreeIterator newTree = new FileTreeIterator(repo);


Thanks for your help in advance =)
Re: Getting diff from two repositories in jGit [message #901405 is a reply to message #896584] Sat, 11 August 2012 20:59 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
See DiffCommandTest.testDiffTwoCommits() [1]

[1] http://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/DiffCommandTest.java
Re: Getting diff from two repositories in jGit [message #908719 is a reply to message #901405] Wed, 05 September 2012 22:02 Go to previous messageGo to next message
Thomas Shippey is currently offline Thomas ShippeyFriend
Messages: 2
Registered: July 2012
Location: London, UK
Junior Member

Thank you so much Mattias. That's great.

Regards

Thomas
Re: Getting diff from two repositories in jGit [message #1183158 is a reply to message #896584] Tue, 12 November 2013 17:29 Go to previous message
Jonathan Clark is currently offline Jonathan ClarkFriend
Messages: 1
Registered: November 2013
Junior Member
Thanks so much. I was running into Out of Memory errors and this created a different way around the issue. Thanks again!
Previous Topic:Can't turn off Log Warnings
Next Topic:Egit bug trackers misconfigured
Goto Forum:
  


Current Time: Wed Apr 24 23:24:58 GMT 2024

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

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

Back to the top