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


Python Commit.iter_items方法代码示例

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


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

示例1: test_commit_iteration

# 需要导入模块: from git import Commit [as 别名]
# 或者: from git.Commit import iter_items [as 别名]
 def test_commit_iteration(self):
     # bound to stream parsing performance
     nc = 0
     st = time()
     for c in Commit.iter_items(self.gitrorepo, self.gitrorepo.head):
         nc += 1
         self._query_commit_info(c)
     # END for each traversed commit
     elapsed_time = time() - st
     print("Iterated %i Commits in %s [s] ( %f commits/s )"
           % (nc, elapsed_time, nc / elapsed_time), file=sys.stderr)
开发者ID:Javex,项目名称:GitPython,代码行数:13,代码来源:test_commit.py

示例2: get_commits_not_in_prs

# 需要导入模块: from git import Commit [as 别名]
# 或者: from git.Commit import iter_items [as 别名]
def get_commits_not_in_prs(start_ref, end_ref):
    """
    Return a tuple of commits that exist between start_ref and end_ref,
    but were not merged to the end_ref. If everyone is following the
    pull request process correctly, this should return an empty tuple.
    """
    return tuple(Commit.iter_items(
        repo,
        "{start}..{end}".format(start=start_ref, end=end_ref),
        first_parent=True, no_merges=True,
    ))
开发者ID:ammerender,项目名称:edx-platform,代码行数:13,代码来源:release.py

示例3: test_iteration

# 需要导入模块: from git import Commit [as 别名]
# 或者: from git.Commit import iter_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

示例4: create_rpmbuild_content

# 需要导入模块: from git import Commit [as 别名]
# 或者: from git.Commit import iter_items [as 别名]
def create_rpmbuild_content(repo, target, config):
    rpm_prefix = config['rpm']['prefix']
    for branch in repo.branches:
        # We only want environment branches, not manifest branches.
        if not branch.name.startswith(manifest_branch_prefix):
            manifest_branch_name = manifest_branch_prefix + branch.name
            # If there is no equivalent manifest branch, we need to
            # skip this environment.
            if manifest_branch_name not in repo.branches:
                continue
            branch.checkout()
            labelled_tags = tags_by_label(os.path.join(repo.working_dir,
                                                       'labels'))

            # Get number of commits to determine the version of the env rpm.
            commit_num = len(list(Commit.iter_items(repo, branch.commit))) 

            # Keep track of the labels which have tags - its those we want.
            for label, tag in labelled_tags.items():
                create_rpmbuild_for_tag(repo, tag, target, config)
                fname = '{}-env-{}-label-{}.spec'.format(rpm_prefix, branch.name, label)
                with open(os.path.join(target, 'SPECS', fname), 'w') as fh:
                    fh.write(generate.render_env(branch.name, label,
                                                 repo, config, tag, commit_num))
开发者ID:bjlittle,项目名称:conda-rpms,代码行数:26,代码来源:build_rpm_structure.py


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