本文整理汇总了Python中gbp.git.GitRepository.get_tags方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepository.get_tags方法的具体用法?Python GitRepository.get_tags怎么用?Python GitRepository.get_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbp.git.GitRepository
的用法示例。
在下文中一共展示了GitRepository.get_tags方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_versions
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_tags [as 别名]
def test_multiple_versions(self):
"""Test importing of multiple versions"""
srpms = [ os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm'),
os.path.join(DATA_DIR, 'gbp-test-1.0-1.other.src.rpm'),
os.path.join(DATA_DIR, 'gbp-test-1.1-1.src.rpm') ]
eq_(mock_import(['--no-pristine-tar', srpms[0]]), 0)
repo = GitRepository('gbp-test')
self._check_repo_state(repo, 'master', ['master', 'upstream'])
eq_(len(repo.get_commits()), 2)
# Try to import same version again
eq_(mock_import([srpms[1]]), 0)
eq_(len(repo.get_commits()), 2)
eq_(len(repo.get_commits(until='upstream')), 1)
eq_(mock_import(['--no-pristine-tar', '--allow-same-version', srpms[1]]), 0)
# Added new version of packaging
eq_(len(repo.get_commits()), 3)
eq_(len(repo.get_commits(until='upstream')), 1)
# Import new version
eq_(mock_import(['--no-pristine-tar', srpms[2]]), 0)
files = {'Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
'gbp-test.spec', 'my.patch', 'my2.patch', 'my3.patch'}
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
eq_(len(repo.get_commits()), 5)
eq_(len(repo.get_commits(until='upstream')), 2)
# Check number of tags
eq_(len(repo.get_tags('upstream/*')), 2)
eq_(len(repo.get_tags('packaging/*')), 3)
示例2: test_tagging
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_tags [as 别名]
def test_tagging(self):
"""Test tag options of import-srpm"""
srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')
# Invalid packaging tag keywords
eq_(mock_import(['--no-pristine-tar', '--packaging-tag=%(foo)s', srpm]),
1)
self._check_log(-1, ".*Missing value 'foo' in *.*")
# Remove upstream tag
repo = GitRepository('gbp-test')
repo.delete_tag('upstream/1.0')
# Invalid upstream tag keywords
eq_(mock_import(['--no-pristine-tar', '--upstream-tag=%(foo)s', srpm]),
1)
self._check_log(-1, ".*Missing value 'foo' in.*")
# Try with good keywords, with --skip-packaging-tag
eq_(mock_import(['--no-pristine-tar', '--vendor=foo',
'--skip-packaging-tag',
'--packaging-tag=%(vendor)s/%(version)s',
'--upstream-tag=upst/%(version)s', srpm]), 0)
eq_(repo.describe('upstream'), 'upst/1.0')
eq_(len(repo.get_tags()), 1)
# Re-import, creating packaging tag
eq_(mock_import(['--no-pristine-tar', '--vendor=foo',
'--packaging-tag=%(vendor)s/%(version)s',
'--upstream-tag=upst/%(version)s', srpm]), 0)
eq_(repo.describe('HEAD'), 'foo/1.0-1')
eq_(len(repo.get_tags()), 2)
示例3: test_misc_options
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_tags [as 别名]
def test_misc_options(self):
"""Test various options of git-import-srpm"""
srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')
eq_(mock_import(['--no-pristine-tar',
'--packaging-branch=pack',
'--upstream-branch=orig',
'--packaging-dir=packaging',
'--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s',
'--upstream-tag=orig/%(upstreamversion)s',
'--author-is-committer',
srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
files = {'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
'packaging/foo.txt', 'packaging/gbp-test2.spec',
'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
'packaging/my2.patch', 'packaging/my3.patch'}
self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
eq_(len(repo.get_commits()), 2)
# Check packaging dir
eq_(len(repo.get_commits(paths='packaging')), 1)
# Check tags
tags = repo.get_tags()
eq_(set(tags), set(['orig/2.0', 'ver_2.0-rel_0']))
# Check git committer/author
info = repo.get_commit_info('pack')
eq_(info['author'].name, 'Markus Lehtonen')
eq_(info['author'].email, '[email protected]')
eq_(info['author'].name, info['committer'].name)
eq_(info['author'].email, info['committer'].email)
示例4: test_multiple_versions
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_tags [as 别名]
def test_multiple_versions(self):
"""Test importing of multiple versions"""
srpms = [
os.path.join(DATA_DIR, "gbp-test-1.0-1.src.rpm"),
os.path.join(DATA_DIR, "gbp-test-1.0-1.other.src.rpm"),
os.path.join(DATA_DIR, "gbp-test-1.1-1.src.rpm"),
]
eq_(mock_import(["--no-pristine-tar", srpms[0]]), 0)
repo = GitRepository("gbp-test")
self._check_repo_state(repo, "master", ["master", "upstream"])
eq_(len(repo.get_commits()), 2)
# Try to import same version again
eq_(mock_import([srpms[1]]), 0)
eq_(len(repo.get_commits()), 2)
eq_(len(repo.get_commits(until="upstream")), 1)
eq_(mock_import(["--no-pristine-tar", "--allow-same-version", srpms[1]]), 0)
# Added new version of packaging
eq_(len(repo.get_commits()), 3)
eq_(len(repo.get_commits(until="upstream")), 1)
# Import new version
eq_(mock_import(["--no-pristine-tar", srpms[2]]), 0)
files = {
"Makefile",
"README",
"bar.tar.gz",
"dummy.sh",
"foo.txt",
"gbp-test.spec",
"my.patch",
"my2.patch",
"my3.patch",
}
self._check_repo_state(repo, "master", ["master", "upstream"], files)
eq_(len(repo.get_commits()), 5)
eq_(len(repo.get_commits(until="upstream")), 2)
# Check number of tags
eq_(len(repo.get_tags("upstream/*")), 2)
eq_(len(repo.get_tags("packaging/*")), 3)
示例5: test_misc_options
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_tags [as 别名]
def test_misc_options(self):
"""Test various options of git-import-srpm"""
srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')
eq_(mock_import(['--no-pristine-tar',
'--packaging-branch=pack',
'--upstream-branch=orig',
'--packaging-dir=packaging',
'--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s',
'--upstream-tag=orig/%(upstreamversion)s',
'--author-is-committer',
srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
files = {'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
'packaging/foo.txt', 'packaging/gbp-test2.spec',
'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
'packaging/my2.patch', 'packaging/my3.patch'}
self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
eq_(len(repo.get_commits()), 2)
# Check packaging dir
eq_(len(repo.get_commits(paths='packaging')), 1)
# Check tags
tags = repo.get_tags()
eq_(set(tags), set(['orig/2.0', 'ver_2.0-rel_0']))
# Check git committer/author
info = repo.get_commit_info('pack')
eq_(info['author'].name, 'Markus Lehtonen')
eq_(info['author'].email, '[email protected]')
eq_(info['author'].name, info['committer'].name)
eq_(info['author'].email, info['committer'].email)
# Create a new commit by committing an empty tree
commit = repo.commit_tree('4b825dc642cb6eb9a060e54bf8d69288fbee4904',
msg="Empty commit", parents=[])
repo.create_tag('foo/1.0', msg="New tag", commit=commit)
# Just blindly import another package on top of this to test more options
os.chdir('gbp-test2')
srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')
eq_(mock_import(['--upstream-vcs-tag=foo/%(version)s',
'--upstream-branch=orig',
'--packaging-branch=pack',
srpm]), 0)
parents = repo.get_commits(until='orig', num=1, options='--format=%P')[0].split()
eq_(len(parents), 2)
ok_(commit in parents)
ok_(repo.rev_parse('orig/2.0^{}') in parents)
示例6: test_misc_options
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_tags [as 别名]
def test_misc_options(self):
"""Test various options of git-import-srpm"""
srpm = os.path.join(DATA_DIR, "gbp-test2-2.0-0.src.rpm")
eq_(
mock_import(
[
"--no-pristine-tar",
"--packaging-branch=pack",
"--upstream-branch=orig",
"--packaging-dir=packaging",
"--packaging-tag=ver_%(upstreamversion)s-rel_%(release)s",
"--upstream-tag=orig/%(upstreamversion)s",
"--author-is-committer",
srpm,
]
),
0,
)
# Check repository state
repo = GitRepository("gbp-test2")
files = {
"Makefile",
"README",
"dummy.sh",
"packaging/bar.tar.gz",
"packaging/foo.txt",
"packaging/gbp-test2.spec",
"packaging/gbp-test2-alt.spec",
"packaging/my.patch",
"packaging/my2.patch",
"packaging/my3.patch",
}
self._check_repo_state(repo, "pack", ["pack", "orig"], files)
eq_(len(repo.get_commits()), 2)
# Check packaging dir
eq_(len(repo.get_commits(paths="packaging")), 1)
# Check tags
tags = repo.get_tags()
eq_(set(tags), set(["orig/2.0", "ver_2.0-rel_0"]))
# Check git committer/author
info = repo.get_commit_info("pack")
eq_(info["author"].name, "Markus Lehtonen")
eq_(info["author"].email, "[email protected]")
eq_(info["author"].name, info["committer"].name)
eq_(info["author"].email, info["committer"].email)
示例7: test_tagging_native
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_tags [as 别名]
def test_tagging_native(self):
"""Test tagging of native packages with import-srpm"""
srpm = os.path.join(DATA_DIR, 'gbp-test-native-1.0-1.src.rpm')
# Invalid packaging tag keywords
eq_(mock_import(['--no-pristine-tar', '--packaging-tag=%(foo)s',
srpm, '--native']), 1)
self._check_log(-1, ".*Missing value 'foo' in {.*")
# Try with good keywords, with --skip-packaging-tag.
# Upstream tag format should not matter
eq_(mock_import(['--no-pristine-tar', '--vendor=foo', '--native',
'--skip-packaging-tag',
'--packaging-tag=%(vendor)s/%(version)s',
'--upstream-tag=%(foo)s', srpm]), 0)
repo = GitRepository('gbp-test-native')
eq_(len(repo.get_tags()), 0)
# Run again, now creating packaging tag
eq_(mock_import(['--no-pristine-tar', '--vendor=foo', '--native',
'--packaging-tag=%(vendor)s/%(version)s',
'--upstream-tag=%(foo)s', srpm]), 0)
eq_(repo.describe('HEAD'), 'foo/1.0-1')