Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Getting diff from two repositories in jGit
Getting diff from two repositories in jGit [message #896584] Wed, 18 July 2012 21:34 Go to next message
Eclipse UserFriend
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 16:59 Go to previous messageGo to next message
Eclipse UserFriend
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 18:02 Go to previous messageGo to next message
Eclipse UserFriend
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 12:29 Go to previous message
Eclipse UserFriend
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: Sun Jul 27 14:12:38 EDT 2025

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

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

Back to the top