So folks, I need the signature of all methods that have changed in a commit, whether updated, removed or added.
Example: In this commit
The methods changed were:
- br.ufrn.ase.Classe1.metodoB(int b)U - br.ufrn.ase.Classe1.getV()D - br.ufrn.ase.Classe1.metodoadicionado()A - br.ufrn.ase.Classe2.metodoQualquer(int i)A - br.ufrn.ase.Classe2.outro(int j)A
Does anyone have any idea how to do this or know of any libs that already do? The code to access the commits and get the blob I already have. I'm developing in Java, but the lib can be in any language.
Thanks in advance.
I was able to solve this problem using the following combination:
- With a git blame between the desired commit and its parent I can extract which lines have been modified and get the respective line numbers;
- I implemented a JDT Parser (using AST.JLS8) that parses the modified files storing the start and end line of each declared method;
- Then just pass the number of the modified row obtained in step 1 and look within the range of methods obtained in step 2.
I didn't get a good result with this Pedro's example, some returned the class package instead of the method signature.