pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

blame at commit support

Open ishepard opened this issue 6 years ago • 4 comments

Sorry if this is already supported, but I can't find in the documention nor in the code.

AFAIK, it's not currently possible to blame a file in a specific commit, right? Something in line with:

git blame hex_oid -- A.java

Would it be possible to implement? Too complicated? What would be the alternative?

Thanks for the awesome library BTW.

ishepard avatar Aug 26 '19 14:08 ishepard

I think there's some git blame support already; is there something that's missing that you're looking for?

https://www.pygit2.org/blame.html

imbuedhope avatar Aug 30 '19 02:08 imbuedhope

I don't find the option for blaming the file in a specific commit. For what I see, you can only blame the file in the index.

I'd like to blame the file in an older commit.

ishepard avatar Aug 30 '19 08:08 ishepard

You should be able to pass in a newest_commit and oldest_commit keyword arg (either an Oid object or a string of the sha) to Repository.blame() to set the range of commits for the Blame object returned.

imbuedhope avatar Aug 31 '19 18:08 imbuedhope

This issue can probably be closed: this seems to be supported already indeed.

wetneb avatar Sep 20 '23 18:09 wetneb