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


Python Commit.list_items方法代码示例

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


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

示例1: test_iteration

# 需要导入模块: from git import Commit [as 别名]
# 或者: from git.Commit import list_items [as 别名]
    def test_iteration(self):
        # we can iterate commits
        all_commits = Commit.list_items(self.rorepo, self.rorepo.head)
        assert all_commits
        assert all_commits == list(self.rorepo.iter_commits())

        # this includes merge commits
        mcomit = self.rorepo.commit('d884adc80c80300b4cc05321494713904ef1df2d')
        assert mcomit in all_commits

        # we can limit the result to paths
        ltd_commits = list(self.rorepo.iter_commits(paths='CHANGES'))
        assert ltd_commits and len(ltd_commits) < len(all_commits)

        # show commits of multiple paths, resulting in a union of commits
        less_ltd_commits = list(Commit.iter_items(self.rorepo, 'master', paths=('CHANGES', 'AUTHORS')))
        assert len(ltd_commits) < len(less_ltd_commits)
开发者ID:yarikoptic,项目名称:GitPython,代码行数:19,代码来源:test_commit.py

示例2: test_list

# 需要导入模块: from git import Commit [as 别名]
# 或者: from git.Commit import list_items [as 别名]
 def test_list(self):
     # This doesn't work anymore, as we will either attempt getattr with bytes, or compare 20 byte string
     # with actual 20 byte bytes. This usage makes no sense anyway
     assert isinstance(Commit.list_items(self.rorepo, '0.1.5', max_count=5)[
                       '5117c9c8a4d3af19a9958677e45cda9269de1541'], Commit)
开发者ID:yarikoptic,项目名称:GitPython,代码行数:7,代码来源:test_commit.py


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