相当于;git标记--包含;在gitpython中

相当于;git标记--包含;在gitpython中,python,git,tags,gitpython,Python,Git,Tags,Gitpython,我试图在gitpython中实现git标记--contains。谁能给我指一下文件吗。我找到了获取所有标记的文档,但没有包含特定提交的标记 tagref = TagReference.list_items(repo)[0] print tagref.commit.message 从。更新2019:如评论中所述,您可以像运行git cli一样使用GitPython“shell out”命令。例如,在本例中,您将使用repo.git.tag(“--contains”,”).split(“\n”)

我试图在gitpython中实现
git标记--contains
。谁能给我指一下文件吗。我找到了获取所有标记的文档,但没有包含特定提交的标记

tagref = TagReference.list_items(repo)[0]
print tagref.commit.message
从。

更新2019:如评论中所述,您可以像运行git cli一样使用GitPython“shell out”命令。例如,在本例中,您将使用
repo.git.tag(“--contains”,”).split(“\n”)


由于这些限制,我已经放弃了GitPython。令人烦恼的是,它不太像吉特。这个简单的类负责git的所有事情(除了新repo和auth的init):

现在,您可以在git中执行任何操作:

>>> git = PyGit("/path/to/repo/")

>>> git("checkout", "master")
["Switched to branch 'master'",
"Your branch is up-to-date with 'origin/master'."]

>>> git("checkout", "develop")
["Switched to branch 'develop'",
"Your branch is up-to-date with 'origin/develop'."]

>>> git("describe", "--tags")
["1.4.0-rev23"]

>>> git("tag", "--contains", "ex4m9le*c00m1t*h4Sh")
["1.4.0-rev23", "MY-SECOND-TAG-rev1"]

添加到github,因为我刚刚开始大量使用它。您已经可以在GitPython中完全做到这一点(剥离到git cli):
repo.git.tag(“--contains”,“ex4m9le*c00m1t*h4Sh”)
…但是您必须添加一个
.split(“\n”)
来获得标记列表。另一方面,在其他情况下,有一个对象接口是有用的,而不仅仅是一直在炮轰。不回答这个问题。这将获取repo中第一个标记的提交消息。问题是如何获取包含特定提交的所有标记的列表。
>>> git = PyGit("/path/to/repo/")

>>> git("checkout", "master")
["Switched to branch 'master'",
"Your branch is up-to-date with 'origin/master'."]

>>> git("checkout", "develop")
["Switched to branch 'develop'",
"Your branch is up-to-date with 'origin/develop'."]

>>> git("describe", "--tags")
["1.4.0-rev23"]

>>> git("tag", "--contains", "ex4m9le*c00m1t*h4Sh")
["1.4.0-rev23", "MY-SECOND-TAG-rev1"]