add tag / push tags to remote in Python Dulwich

若如初见. 提交于 2020-03-03 08:50:58

问题


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:

  1. git push --tags --force
  2. git tag --force
  3. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!