Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Getting the list of modified files from a commit
Getting the list of modified files from a commit [message #867455] Tue, 01 May 2012 09:55 Go to next message
Éloi Rivard is currently offline Éloi RivardFriend
Messages: 1
Registered: May 2012
Junior Member
Hello,
I'm developping an eclipse independant application and I'd like to get the list of modified files from a commit with JGit.

This code does not work. Do you know what's wrong ?
Repository repo = ...
RevCommit commit = ...
	
FileTreeIterator fileTreeIterator = new FileTreeIterator(repo);
IndexDiff indexDiff = new IndexDiff(repo, commit.getId(), fileTreeIterator);
			
System.out.println(indexDiff.getChanged()); 
System.out.println(indexDiff.getAdded()); 


Thanks
Re: Getting the list of modified files from a commit [message #868557 is a reply to message #867455] Wed, 02 May 2012 08:11 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
You should run the diff operation before you ask for the results. Just add indexDiff.diff() before you call indexDiff.get...()

Ciao
Chris
Re: Getting the list of modified files from a commit [message #886172 is a reply to message #868557] Thu, 14 June 2012 11:32 Go to previous messageGo to next message
Uria Ashkenazy Adler is currently offline Uria Ashkenazy AdlerFriend
Messages: 1
Registered: June 2012
Junior Member
Hi,

I'm trying to do the same, but this code gives me the diff between the head of the repository and the specified commit. I'm only interested in the changes introduced by the specified commit (meaning the diff between the commit and the previous revision).

I can't figure out how to do that, perhaps get a TreeIterator for the previous commit... but I don't know how to do that.

In other words, I'm trying to get a diff between 2 revisions by providing the hash of each revision. Any help would be much appreciated.

Thanks!
Re: Getting the list of modified files from a commit [message #894460 is a reply to message #868557] Mon, 09 July 2012 10:12 Go to previous messageGo to next message
Rahul Chandrashekar is currently offline Rahul ChandrashekarFriend
Messages: 43
Registered: July 2009
Member
Hi,

How can i get the list of commited files from the repository. I do not find any API to do the same.

Please let know.

Regds
Rahul
Re: Getting the list of modified files from a commit [message #894461 is a reply to message #867455] Mon, 09 July 2012 10:13 Go to previous messageGo to next message
Rahul Chandrashekar is currently offline Rahul ChandrashekarFriend
Messages: 43
Registered: July 2009
Member
Hi,

How do i get the commit.getId(), are there any means of getting the same.

Regds
Rahul.
Re: Getting the list of modified files from a commit [message #902397 is a reply to message #894461] Fri, 17 August 2012 13:11 Go to previous message
Stefan Lay is currently offline Stefan LayFriend
Messages: 342
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
Previous Topic:diff across a rename boundary?
Next Topic:still no decorations for local tracking?
Goto Forum:
  


Current Time: Tue Mar 19 02:42:24 GMT 2024

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

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

Back to the top