问题
I like the Dulwich project as it provides pure Python interface to interacting with git.
It looks pretty low-level though... While I couldn't find reference on how to perform simple tasks.
My need's are pretty simple, provide the same as below git CLI commands:
git push --tags --force
git tag --force
git show-ref --tags
(provides mapping between tag and the commit it points on)
Update:
looks like item #3 is answered here:
How to get a list of tags and create new tags with python and dulwich in git? (by Jelmer the creator of Dulwich)
回答1:
The dulwich.porcelain (https://www.dulwich.io/docs/api/dulwich.porcelain.html#module-dulwich.porcelain) module is somewhat more high level, and should do what you need.
Specifically, the push and tag_create functions. Note that there is currently no force argument since all tag editing is currently done without safety checking.
来源:https://stackoverflow.com/questions/60139728/add-tag-push-tags-to-remote-in-python-dulwich