标签:调用 xxxxxx python info commit 统计代码行数 ima xxxx table
需求:根据时间段,统计各个研发提交的代码行
实现逻辑:调用原生gitlab接口太复杂,引用python-gitlab 获取commit详情,然后进行统计
===============================================
简单代码
import gitlab client = gitlab.Gitlab(‘http://xxxxxx:8080/‘, private_token=‘ziKtexMN5Zfj37qRGLsW‘, timeout=5, api_version=‘4‘) client.auth() project = client.projects.list() for pro in project: print(pro) commits = pro.commits.list(since=‘2019-08-11T00:00:00Z‘, ref_name=‘dev‘) for c in commits: print(pro.commits.get(c.id))
返回结果:
python-gitlab api 文档:https://python-gitlab.readthedocs.io/en/stable/gl_objects/commits.html
标签:调用 xxxxxx python info commit 统计代码行数 ima xxxx table
原文地址:https://www.cnblogs.com/dannyyao/p/11405432.html