Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » How to JGit blame a file before commit?
icon5.gif  How to JGit blame a file before commit? [message #1730248] Fri, 22 April 2016 15:09
Alcemir Santos is currently offline Alcemir SantosFriend
Messages: 23
Registered: July 2012
Junior Member

Context: My merge ran into conflicts and I have a file like this example:

Foo.txt (merged)
1
<<<<<< HEAD
2-master
======
2-side
>>>>>> df803849788fde47965b3dc8f07f07d48320ea9c
3


Question: In order to get the developers who actually changed the conflicting lines, how to blame result file (above) prior to the commit? It works for "git blame Foo.txt".

Problem: I tried to do the following, but the blame is null inside the loop.

MergeResult m = runMerge(aScenario);
BlameCommand blamer = new BlameCommand(git.getRepository());
BufferedReader br =  new BufferedReader(new FileReader(new File(mergedfilepath)));
BlameResult blame = blamer.setFilePath(mergedfilepath).call();
for (int i = 0; (line= br.readLine())!=null ; i++) {
    // the blame at this point is null.
    PersonIdent person = blame.getSourceAuthor(i);
    System.out.println(person.getName() + ": "+ line);
}
Previous Topic:How to define a "In between" JGit RevFilter?
Next Topic:eGit Install on CF Builder 3
Goto Forum:
  


Current Time: Tue Oct 15 13:46:49 GMT 2019

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

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

Back to the top