Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to retrieve the entire patch from a Commit object in PyDriller? #226

Open
41241241241 opened this issue Aug 9, 2022 · 4 comments
Labels
enhancement New feature or request PR welcome Issue is confirmed, but not fixed yet

Comments

@41241241241
Copy link

41241241241 commented Aug 9, 2022

Hi PyDriller team, thanks for your great package. I am wondering if there is currently a way to retrieve the entire patch string from a Commit object in PyDriller?

My team currently has a use case where we would like to store several artefacts from a commit into our database, including the full patch, in case we want to do our own custom parsing or processing. Reading the most recent version of the docs, I don't think this is currently possible (and honestly when I consider the main point of PyDriller, which IMO is to parse and process the patch info for us, it kind of makes sense that this might not be available). However as we are already using PyDriller, and we are assuming the package must be obtaining and maybe storing the entire patch in some way or another, I'm wondering if there is an some way we can get it from a Commit object, like "commit.patch". I know we can retrieve it using the Git API, or even scraping it from a URL such as "https://github.com/ishepard/pydriller/commit/250391839afcad3320e451c841090ccc69407e94.patch", but it would make it easier to just get it from PyDriller somehow. Thanks!

@stefanodallapalma
Copy link
Contributor

Hi @41241241241 ,

Can you please clarify what do you mean with "entire patch string of a Commit"? I assume you refer to the modifications of all the files in the commit.
In that case, you may want to take a look at the ModifiedFile object, which stores information about a file's diff, content before and after the commit, in addition to added and deleted lines.

Hope that helps!

@ishepard ishepard added enhancement New feature or request PR welcome Issue is confirmed, but not fixed yet labels Oct 1, 2022
@ishepard
Copy link
Owner

ishepard commented Oct 1, 2022

There should be a way to retrieve the entire patch like what you linked: https://github.com/ishepard/pydriller/commit/250391839afcad3320e451c841090ccc69407e94.patch

ModifiedFile is just the "parsed" version of it.

Marking this as a PR, if anyone wants to pick it up.

@Azanul
Copy link

Azanul commented Feb 6, 2023

@ishepard may I work on this?

@ishepard
Copy link
Owner

ishepard commented Jun 1, 2023

@ishepard may I work on this?

I'd love that, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR welcome Issue is confirmed, but not fixed yet
Projects
None yet
Development

No branches or pull requests

4 participants