本文整理汇总了Python中gbp.git.GitRepository.get_commits方法的典型用法代码示例。如果您正苦于以下问题:Python GitRepository.get_commits方法的具体用法?Python GitRepository.get_commits怎么用?Python GitRepository.get_commits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbp.git.GitRepository
的用法示例。
在下文中一共展示了GitRepository.get_commits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_misc_options
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [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)
示例2: test_misc_options
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [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)
示例3: test_misc_options
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [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_commits [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_import_no_orig_src
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_import_no_orig_src(self):
"""Test importing of (native) srpm without orig tarball"""
srpm = os.path.join(DATA_DIR, 'gbp-test-native2-2.0-0.src.rpm')
eq_(mock_import([srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test-native2')
self._check_repo_state(repo, 'master', ['master'])
# Only one commit: packaging files
eq_(len(repo.get_commits()), 1)
示例6: test_basic_import_pristine_tar
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import_pristine_tar(self):
"""Test importing of non-native src.rpm, with pristine-tar"""
srpm = os.path.join(DATA_DIR, "gbp-test-1.0-1.src.rpm")
eq_(mock_import(["--pristine-tar", srpm]), 0)
# Check repository state
repo = GitRepository("gbp-test")
self._check_repo_state(repo, "master", ["master", "upstream", "pristine-tar"])
# Two commits: upstream and packaging files
eq_(len(repo.get_commits()), 2)
示例7: test_basic_import_pristine_tar
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import_pristine_tar(self):
"""Test importing of non-native src.rpm, with pristine-tar"""
srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')
eq_(mock_import(['--pristine-tar', srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test')
self._check_repo_state(repo, 'master', ['master', 'upstream',
'pristine-tar'])
# Two commits: upstream and packaging files
eq_(len(repo.get_commits()), 2)
示例8: test_basic_native_import
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_native_import(self):
"""Test importing of native src.rpm"""
srpm = os.path.join(DATA_DIR, "gbp-test-native-1.0-1.src.rpm")
eq_(mock_import(["--native", srpm]), 0)
# Check repository state
files = {".gbp.conf", "Makefile", "README", "dummy.sh", "packaging/gbp-test-native.spec"}
repo = GitRepository("gbp-test-native")
self._check_repo_state(repo, "master", ["master"], files)
# Only one commit: the imported source tarball
eq_(len(repo.get_commits()), 1)
示例9: test_basic_native_import
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_native_import(self):
"""Test importing of native src.rpm"""
srpm = os.path.join(DATA_DIR, 'gbp-test-native-1.0-1.src.rpm')
eq_(mock_import(['--native', srpm]), 0)
# Check repository state
files = {'.gbp.conf', 'Makefile', 'README', 'dummy.sh',
'packaging/gbp-test-native.spec'}
repo = GitRepository('gbp-test-native')
self._check_repo_state(repo, 'master', ['master'], files)
# Only one commit: the imported source tarball
eq_(len(repo.get_commits()), 1)
示例10: test_basic_import
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import(self):
"""Test importing of non-native src.rpm"""
srpm = os.path.join(DATA_DIR, 'gbp-test-1.0-1.src.rpm')
eq_(mock_import(['--no-pristine-tar', srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test')
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)
# Two commits: upstream and packaging files
eq_(len(repo.get_commits()), 2)
示例11: test_basic_import2
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import2(self):
"""Import package with multiple spec files and full url patch"""
srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')
eq_(mock_import(['--no-pristine-tar', srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
files = {'Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
'gbp-test2.spec', 'gbp-test2-alt.spec', 'my.patch',
'my2.patch', 'my3.patch'}
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
# Two commits: upstream and packaging files
eq_(len(repo.get_commits()), 2)
示例12: test_basic_import_orphan
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import_orphan(self):
"""
Test importing of non-native src.rpm to separate packaging and
development branches
"""
srpm = os.path.join(DATA_DIR, "gbp-test2-2.0-0.src.rpm")
eq_(mock_import(["--no-pristine-tar", "--orphan-packaging", srpm]), 0)
# Check repository state
repo = GitRepository("gbp-test2")
files = {"bar.tar.gz", "foo.txt", "gbp-test2.spec", "gbp-test2-alt.spec", "my.patch", "my2.patch", "my3.patch"}
self._check_repo_state(repo, "master", ["master", "upstream"], files)
# Only one commit: the packaging files
eq_(len(repo.get_commits()), 1)
示例13: test_basic_import_orphan
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import_orphan(self):
"""
Test importing of non-native src.rpm to separate packaging and
development branches
"""
srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm')
eq_(mock_import(['--no-pristine-tar', '--orphan-packaging', srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
files = {'bar.tar.gz', 'foo.txt', 'gbp-test2.spec',
'gbp-test2-alt.spec', 'my.patch', 'my2.patch', 'my3.patch'}
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
# Only one commit: the packaging files
eq_(len(repo.get_commits()), 1)
示例14: test_basic_import
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import(self):
"""Test importing of non-native src.rpm"""
srpm = os.path.join(DATA_DIR, "gbp-test-1.0-1.src.rpm")
eq_(mock_import(["--no-pristine-tar", srpm]), 0)
# Check repository state
repo = GitRepository("gbp-test")
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)
# Two commits: upstream and packaging files
eq_(len(repo.get_commits()), 2)
示例15: test_basic_import2
# 需要导入模块: from gbp.git import GitRepository [as 别名]
# 或者: from gbp.git.GitRepository import get_commits [as 别名]
def test_basic_import2(self):
"""Import package with multiple spec files and full url patch"""
srpm = os.path.join(DATA_DIR, "gbp-test2-2.0-0.src.rpm")
eq_(mock_import(["--no-pristine-tar", srpm]), 0)
# Check repository state
repo = GitRepository("gbp-test2")
files = {
"Makefile",
"README",
"bar.tar.gz",
"dummy.sh",
"foo.txt",
"gbp-test2.spec",
"gbp-test2-alt.spec",
"my.patch",
"my2.patch",
"my3.patch",
}
self._check_repo_state(repo, "master", ["master", "upstream"], files)
# Two commits: upstream and packaging files
eq_(len(repo.get_commits()), 2)