在Python Dulwich中将标签/推送标签添加到远程 [英] add tag / push tags to remote in Python Dulwich

查看:93
本文介绍了在Python Dulwich中将标签/推送标签添加到远程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢 Dulwich 项目,因为它提供了与git交互的纯Python接口.

I like the Dulwich project as it provides pure Python interface to interacting with git.

虽然看起来很底层……但是我找不到如何执行简单任务的参考.
我的需求非常简单,提供与下面的git CLI命令相同的内容:

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(提供标签和它指向的提交之间的映射)
  1. git push --tags --force
  2. git tag --force
  3. git show-ref --tags (provides mapping between tag and the commit it points on)


更新: 似乎在这里回答了第3项:


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)

推荐答案

dulwich.porcelain(

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.

特别是push和tag_create函数.请注意,当前没有强制参数,因为当前所有标签编辑都在没有安全检查的情况下完成.

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.

这篇关于在Python Dulwich中将标签/推送标签添加到远程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆