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


Python GitRepository.commit_tree方法代码示例

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


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

示例1: test_misc_options

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


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