Reference: https://git-scm.com/docs/git-patch-id
\nQ: How can I get the same output using GitPython?
","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"I got it to work with this:
\ndef get_patch_id(commit: str) -> str:\n \"\"\"\n Get patch-id of a commit.\n a patch id is a unique ID for a patch (git show)\n ref: https://git-scm.com/docs/git-patch-id\n \"\"\"\n with Repo(repo_path) as repo:\n with tempfile.TemporaryFile() as temp_file:\n # output_stream = BytesIO()\n repo.git.show(commit, output_stream=temp_file)\n temp_file.seek(0)\n return repo.git.patch_id(istream=temp_file).split()[0]\n
-
This is command-line syntax to get patch-id for a commit
Reference: https://git-scm.com/docs/git-patch-id Q: How can I get the same output using GitPython? |
Beta Was this translation helpful? Give feedback.
-
You would have to use |
Beta Was this translation helpful? Give feedback.
-
I got it to work with this:
|
Beta Was this translation helpful? Give feedback.
I got it to work with this: