当前位置: 首页>>代码示例>>Python>>正文


Python ComponentTestGitRepository.get_commit_info方法代码示例

本文整理汇总了Python中tests.component.ComponentTestGitRepository.get_commit_info方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentTestGitRepository.get_commit_info方法的具体用法?Python ComponentTestGitRepository.get_commit_info怎么用?Python ComponentTestGitRepository.get_commit_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.component.ComponentTestGitRepository的用法示例。


在下文中一共展示了ComponentTestGitRepository.get_commit_info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_import_debian_native

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commit_info [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)
开发者ID:,项目名称:,代码行数:35,代码来源:

示例2: test_bare

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commit_info [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)
开发者ID:agx,项目名称:git-buildpackage,代码行数:33,代码来源:test_import_dsc.py

示例3: test_import_30_pristine_tar

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commit_info [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))
开发者ID:agx,项目名称:git-buildpackage,代码行数:32,代码来源:test_import_dsc.py

示例4: test_bare

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commit_info [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)
开发者ID:,项目名称:,代码行数:40,代码来源:

示例5: test_import_multiple_pristine_tar

# 需要导入模块: from tests.component import ComponentTestGitRepository [as 别名]
# 或者: from tests.component.ComponentTestGitRepository import get_commit_info [as 别名]
    def test_import_multiple_pristine_tar(self):
        """Test if importing a multiple tarball package works"""
        def _dsc(version):
            return os.path.join(DEB_TEST_DATA_DIR,
                                'dsc-3.0-additional-tarballs',
                                'hello-debhelper_%s.dsc' % version)

        dscfile = _dsc('2.8-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']
        ok_("hello-debhelper (2.8-1) unstable; urgency=low" in commitmsg)
        ok_("hello (1.3-7) experimental; urgency=LOW" in commitmsg)

        for file in ['foo/test1', 'foo/test2']:
            ok_(file in repo.ls_tree('HEAD'),
                "Could not find component tarball file %s in %s" % (file, repo.ls_tree('HEAD')))

        ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))

        dsc = DscFile.parse(dscfile)
        # Check if we can rebuild the tarball and component
        ptars = [('hello-debhelper_2.8.orig.tar.gz', 'pristine-tar', '', dsc.tgz),
                 ('hello-debhelper_2.8.orig-foo.tar.gz', 'pristine-tar^', 'foo', dsc.additional_tarballs['foo'])]

        p = DebianPristineTar(repo)
        outdir = os.path.abspath('.')
        for f, w, s, o in ptars:
            eq_(repo.get_subject(w), 'pristine-tar data for %s' % f)
            old = self.hash_file(o)
            p.checkout('hello-debhelper', '2.8', 'gzip', outdir, component=s)
            new = self.hash_file(os.path.join(outdir, f))
            eq_(old, new, "Checksum %s of regenerated tarball %s does not match original %s" %
                (f, old, new))
开发者ID:,项目名称:,代码行数:43,代码来源:


注:本文中的tests.component.ComponentTestGitRepository.get_commit_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。