本文整理汇总了Python中datalad.support.gitrepo.GitRepo.get_tags方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepo.get_tags方法的具体用法?Python GitRepo.get_tags怎么用?Python GitRepo.get_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datalad.support.gitrepo.GitRepo
的用法示例。
在下文中一共展示了GitRepo.get_tags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_tags
# 需要导入模块: from datalad.support.gitrepo import GitRepo [as 别名]
# 或者: from datalad.support.gitrepo.GitRepo import get_tags [as 别名]
def test_get_tags(path):
from mock import patch
gr = GitRepo(path, create=True)
eq_(gr.get_tags(), [])
eq_(gr.describe(), None)
# Explicitly override the committer date because tests may set it to a
# fixed value, but we want to check that the returned tags are sorted by
# the committer date.
with patch.dict("os.environ", {"GIT_COMMITTER_DATE":
"Thu, 07 Apr 2005 22:13:13 +0200"}):
create_tree(gr.path, {'file': ""})
gr.add('file')
gr.commit(msg="msg")
eq_(gr.get_tags(), [])
eq_(gr.describe(), None)
gr.tag("nonannotated")
tags1 = [{'name': 'nonannotated', 'hexsha': gr.get_hexsha()}]
eq_(gr.get_tags(), tags1)
eq_(gr.describe(), None)
eq_(gr.describe(tags=True), tags1[0]['name'])
first_commit = gr.get_hexsha()
with patch.dict("os.environ", {"GIT_COMMITTER_DATE":
"Fri, 08 Apr 2005 22:13:13 +0200"}):
create_tree(gr.path, {'file': "123"})
gr.add('file')
gr.commit(msg="changed")
gr.tag("annotated", message="annotation")
tags2 = tags1 + [{'name': 'annotated', 'hexsha': gr.get_hexsha()}]
eq_(gr.get_tags(), tags2)
eq_(gr.describe(), tags2[1]['name'])
# compare prev commit
eq_(gr.describe(commitish=first_commit), None)
eq_(gr.describe(commitish=first_commit, tags=True), tags1[0]['name'])