本文整理汇总了Python中tests.component.ComponentTestGitRepository.get_commits方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentTestGitRepository.get_commits方法的具体用法?Python ComponentTestGitRepository.get_commits怎么用?Python ComponentTestGitRepository.get_commits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.component.ComponentTestGitRepository
的用法示例。
在下文中一共展示了ComponentTestGitRepository.get_commits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bare
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_bare(self):
"""Test that importing into bare repository works"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
os.chdir('hello-debhelper')
assert len(repo.get_commits()) == 2
self._check_reflog(repo)
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("hello-debhelper (2.6-2) unstable; urgency=medium" in commitmsg)
ok_("hello (1.3-7) experimental; urgency=LOW" in commitmsg)
dsc = self._dsc30('2.8-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
commits, expected = len(repo.get_commits()), 4
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("hello-debhelper (2.8-1) unstable; urgency=low" in commitmsg)
ok_("ello-debhelper (2.7-1) unstable; urgency=low" in commitmsg)
ok_("hello-debhelper (2.6-2) unstable; urgency=medium" not in commitmsg)
示例2: test_import_debian_native
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_import_debian_native(self):
"""Test that importing of debian native packages works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-native',
'git-buildpackage_%s.dsc' % version)
dsc = _dsc('0.4.14')
assert import_dsc(['arg0', dsc]) == 0
repo = ComponentTestGitRepository('git-buildpackage')
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 1
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("git-buildpackage (0.01) unstable; urgency=low" in commitmsg)
ok_("git-buildpackage (0.4.14) unstable; urgency=low" in commitmsg)
os.chdir('git-buildpackage')
dsc = _dsc('0.4.15')
assert import_dsc(['arg0', dsc]) == 0
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 2
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("git-buildpackage (0.4.14) unstable; urgency=low" not in commitmsg)
ok_("git-buildpackage (0.4.15) unstable; urgency=low" in commitmsg)
dsc = _dsc('0.4.16')
assert import_dsc(['arg0', dsc]) == 0
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 3
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("git-buildpackage (0.4.14) unstable; urgency=low" not in commitmsg)
ok_("git-buildpackage (0.4.15) unstable; urgency=low" not in commitmsg)
ok_("git-buildpackage (0.4.16) unstable; urgency=low" in commitmsg)
示例3: test_create_branches
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_create_branches(self):
"""Test if creating missing branches works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR, "dsc-3.0", "hello-debhelper_%s.dsc" % version)
dsc = _dsc("2.6-2")
assert (
import_dsc(
["arg0", "--verbose", "--pristine-tar", "--debian-branch=master", "--upstream-branch=upstream", dsc]
)
== 0
)
repo = ComponentTestGitRepository("hello-debhelper")
os.chdir("hello-debhelper")
assert len(repo.get_commits()) == 2
self._check_repo_state(repo, "master", ["master", "pristine-tar", "upstream"])
dsc = _dsc("2.8-1")
assert (
import_dsc(
[
"arg0",
"--verbose",
"--pristine-tar",
"--debian-branch=foo",
"--upstream-branch=bar",
"--create-missing-branches",
dsc,
]
)
== 0
)
self._check_repo_state(repo, "master", ["bar", "foo", "master", "pristine-tar", "upstream"])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
示例4: test_create_branches
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_create_branches(self):
"""Test if creating missing branches works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-3.0',
'hello-debhelper_%s.dsc' % version)
dsc = _dsc('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
os.chdir('hello-debhelper')
assert len(repo.get_commits()) == 2
reflog, ret = repo._git_getoutput('reflog')
ok_("gbp: Import Debian changes" in reflog[1])
ok_("gbp: Import Upstream version 2.6" in reflog[2])
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
dsc = _dsc('2.8-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=foo',
'--upstream-branch=bar',
'--create-missing-branches',
dsc]) == 0
self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
示例5: test_import_30_pristine_tar
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_import_30_pristine_tar(self):
dscfile = self._dsc30('2.6-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dscfile]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
commits, expected = len(repo.get_commits()), 2
commitmsg = repo.get_commit_info('HEAD')['body']
eq_("hello-debhelper (2.6-1) unstable; urgency=low", commitmsg.split('\n')[0])
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
os.chdir(repo.path)
dscfile = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dscfile]) == 0
commits, expected = len(repo.get_commits()), 3
commitmsg = repo.get_commit_info('HEAD')['body']
eq_("hello-debhelper (2.6-2) unstable; urgency=medium", commitmsg.split('\n')[0])
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
commits, expected = len(repo.get_commits(until='pristine-tar')), 1
ok_(commits == expected, "Found %d pristine-tar commits instead of %d" % (commits, expected))
示例6: test_pull_all
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_pull_all(self, repo):
"""Test the '--all' commandline option"""
# Create new branch in repo
repo.create_branch('foob')
# Clone and create new commits in origin
dest = os.path.join(self._tmpdir, 'cloned_repo')
clone(['arg0', '--all', repo.path, dest])
cloned = ComponentTestGitRepository(dest)
tmp_workdir = os.path.join(self._tmpdir, 'tmp_workdir')
os.mkdir(tmp_workdir)
with open(os.path.join(tmp_workdir, 'new_file'), 'w'):
pass
repo.commit_dir(tmp_workdir, 'New commit in master', branch='master')
repo.commit_dir(tmp_workdir, 'New commit in foob', branch='foob')
# Check that the branch is not updated when --all is not used
eq_(pull(['argv0']), 0)
eq_(len(cloned.get_commits(until='master')), 3)
eq_(len(cloned.get_commits(until='upstream')), 1)
eq_(len(cloned.get_commits(until='foob')), 2)
# Check that --all updates all branches
repo.commit_dir(tmp_workdir, 'New commit in upstream', branch='upstream')
eq_(pull(['argv0', '--all']), 0)
eq_(len(cloned.get_commits(until='foob')), 3)
eq_(len(cloned.get_commits(until='upstream')), 2)
示例7: test_create_branches
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_create_branches(self):
"""Test that creating missing branches works"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
os.chdir('hello-debhelper')
assert len(repo.get_commits()) == 2
self._check_reflog(repo)
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
dsc = self._dsc30('2.8-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=foo',
'--upstream-branch=bar',
'--create-missing-branches',
dsc]) == 0
self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
示例8: test_clone_native
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_clone_native(self, repo):
"""Test that cloning of debian native packages works"""
dest = os.path.join(self._tmpdir,
'cloned_repo')
clone(['arg0',
'--postclone=printenv > ../postclone.out',
repo.path, dest])
cloned = ComponentTestGitRepository(dest)
self._check_repo_state(cloned, 'master', ['master'])
assert len(cloned.get_commits()) == 1
self.check_hook_vars('../postclone', ["GBP_GIT_DIR"])
示例9: test_download
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_download(self):
def _dsc(version):
return os.path.join(DEB_TEST_DOWNLOAD_URL,
'dsc-native',
'git-buildpackage_%s.dsc' % version)
dsc = _dsc('0.4.14')
assert import_dsc(['arg0',
'--allow-unauthenticated',
dsc]) == 0
repo = ComponentTestGitRepository('git-buildpackage')
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 1
示例10: test_debian_import
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_debian_import(self):
"""Test that importing of debian native packages works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR, "dsc-native", "git-buildpackage_%s.dsc" % version)
dsc = _dsc("0.4.14")
assert import_dsc(["arg0", dsc]) == 0
repo = ComponentTestGitRepository("git-buildpackage")
self._check_repo_state(repo, "master", ["master"])
assert len(repo.get_commits()) == 1
os.chdir("git-buildpackage")
dsc = _dsc("0.4.15")
assert import_dsc(["arg0", dsc]) == 0
self._check_repo_state(repo, "master", ["master"])
assert len(repo.get_commits()) == 2
dsc = _dsc("0.4.16")
assert import_dsc(["arg0", dsc]) == 0
self._check_repo_state(repo, "master", ["master"])
assert len(repo.get_commits()) == 3
示例11: test_debian_branch_not_master
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_debian_branch_not_master(self):
"""Make sure we only have debian-branch and upstream-branch after an initial import"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--no-pristine-tar',
'--debian-branch=pk4',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
self._check_repo_state(repo, 'pk4', ['pk4', 'upstream'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
示例12: test_upstream_branch_is_master
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_upstream_branch_is_master(self):
"""Make sure we can import when upstream-branch == master (#750962)"""
dsc = self._dsc30('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--no-pristine-tar',
'--debian-branch=debian',
'--upstream-branch=master',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
self._check_repo_state(repo, 'debian', ['debian', 'master'])
commits, expected = len(repo.get_commits()), 2
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
示例13: test_import_10
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_import_10(self):
"""Test if importing a 1.0 source format package works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-1.0',
'hello-debhelper_%s.dsc' % version)
dsc = _dsc('2.6-2')
assert import_dsc(['arg0', dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
self._check_repo_state(repo, 'master', ['master', 'upstream'],
tags=['upstream/2.6', 'debian/2.6-2'])
assert len(repo.get_commits()) == 2
示例14: test_bare
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_bare(self):
"""Test if importing into bare repository"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-3.0',
'hello-debhelper_%s.dsc' % version)
dsc = _dsc('2.6-2')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
repo = ComponentTestGitRepository('hello-debhelper')
os.chdir('hello-debhelper')
assert len(repo.get_commits()) == 2
reflog, ret = repo._git_getoutput('reflog')
ok_("gbp: Import Debian changes" in reflog[1])
ok_("gbp: Import Upstream version 2.6" in reflog[2])
self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("hello-debhelper (2.6-2) unstable; urgency=medium" in commitmsg)
ok_("hello (1.3-7) experimental; urgency=LOW" in commitmsg)
dsc = _dsc('2.8-1')
assert import_dsc(['arg0',
'--verbose',
'--pristine-tar',
'--debian-branch=master',
'--upstream-branch=upstream',
dsc]) == 0
commits, expected = len(repo.get_commits()), 4
ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))
commitmsg = repo.get_commit_info('HEAD')['body']
ok_("hello-debhelper (2.8-1) unstable; urgency=low" in commitmsg)
ok_("ello-debhelper (2.7-1) unstable; urgency=low" in commitmsg)
ok_("hello-debhelper (2.6-2) unstable; urgency=medium" not in commitmsg)
示例15: test_clone_native
# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commits [as 别名]
def test_clone_native(self):
"""Test that cloning of debian native packages works"""
def _dsc(version):
return os.path.join(DEB_TEST_DATA_DIR,
'dsc-native',
'git-buildpackage_%s.dsc' % version)
# Build up somethng we can clone from
dsc = _dsc('0.4.14')
assert import_dsc(['arg0', dsc]) == 0
repo = ComponentTestGitRepository('git-buildpackage')
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 1
dest = os.path.join(self._tmpdir,
'cloned_repo')
clone(['arg0',
'--postclone=printenv > postclone.out',
repo.path, dest])
cloned = ComponentTestGitRepository(dest)
self._check_repo_state(cloned, 'master', ['master'])
assert len(cloned.get_commits()) == 1
self.check_hook_vars('postclone', ["GBP_GIT_DIR"])