简体   繁体   中英

add tag / push tags to remote in Python Dulwich

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM