-
-
Notifications
You must be signed in to change notification settings - Fork 954
Is there a way to do git blame --reverse
?
#1397
-
I can do git blame on a file in the following way:
for commit, lines in repo.blame(commit, filepath):
<process commit and lines>
However, I also want to do git blame --reverse START..END filename
to blame the commit that deleted a line present at the START commit (or more specifically, the last commit within START..END
where the line was present). Is there any way I can gitpython
to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions
I think with the current implementation it's not possible as it will always pass commit
as argument. Ideally, one would be able to do something like repo.blame(filepath, reverse='<start>..<end>')
.
That would probably be fine for the parser, but it would need some refactoring to expose it in the public API.
Replies: 1 comment 2 replies
-
I think with the current implementation it's not possible as it will always pass commit
as argument. Ideally, one would be able to do something like repo.blame(filepath, reverse='<start>..<end>')
.
That would probably be fine for the parser, but it would need some refactoring to expose it in the public API.
Beta Was this translation helpful? Give feedback.
All reactions
-
repo.blame(('--reverse', 'HEAD~1..HEAD'), "myfile") does appear to work for my use cases. I'm unsure if I lucked out or that was intentional. (git-python==1.0.3).
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks for sharing - if it works it works and I'd expect that it stays that way.
Beta Was this translation helpful? Give feedback.