ishepard / pydriller

Python Framework to analyse Git repositories
http://pydriller.readthedocs.io/en/latest/
Apache License 2.0
810 stars 138 forks source link

How to identify when a method is renamed. #290

Open ricardojob opened 6 months ago

ricardojob commented 6 months ago

I often need to identify when a method is renamed.

For example, in the following codes, we have two versions of the Sample class.

#version 1        
class Sample:
    def m3(self):
        print("any")

We can see that there were two changes to this commit. On line 3, print("added") was added and, on line 2, the m3 method was renamed to m5.

#version 2         
class Sample:
    def m5(self):
        print("added")
        print("any")

When we iterate over the commits, we can use the changed_methods method (class ModifiedFile) to identify the list of methods that were changed. However, in the previous code snippets the m5 method is identified as a new method.

Is there a way to identify that the method has been renamed?