github api:如何高效地找到存储库的提交数量? [英] github api: How to efficiently find the number of commits for a repository?

查看:142
本文介绍了github api:如何高效地找到存储库的提交数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想查找针对特定github项目提交的提交数量,并在其中指定特定的文件。我检查了 github api文档,但只发现了一个实际返回所有提交的API。这将是非常低效的,因为我必须通过所有提交进行多个API调用来进行寻呼。



任何人有更好的主意? 更新2013年5月:请参阅文件CRUD和存储库统计现在在API中可用



您现在可以获取提交活动数据的最后一年

 GET / repos /:owner /:repo / stats / commit_activity 



< blockquote>

返回按星期分组的提交活动的最后一年。天数组是每天的一组提交,从星期天开始。


完全 你是什么寻找,但更接近。






原始答案(2010年4月)

不,目前的API不支持' log --all '列出所有分行的所有通讯。



唯一的选择是在 Github API:检索所有分支的所有提交以进行回购,并列出所有提交的所有页面,<分支之后的分支。



这看起来比另一个替代方案实际上克服Github repo和在本地克隆上应用git命令

(主要是 git shortlog





:您还可以签出由 python脚本 / arcsector> Arcsector 。


I want to find the number of commits done to specific github projects, and within them to specific files. I checked the github api docs but only found an API for actually returning all commits. This would be very inefficient since I have to do multiple api calls for paging thru all commits.

Anyone has a better idea?

解决方案

Update May 2013: see "File CRUD and repository statistics now available in the API"

You now can Get the last year of commit activity data

GET /repos/:owner/:repo/stats/commit_activity

Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday.

Not completely what you are looking for, but closer.


Original answer (April 2010)

No, the current API doesn't support a 'log --all' for listing all commmits from all branches.

The only alternative is presented in "Github API: Retrieve all commits for all branches for a repo", and list through all pages of all commits, branch after branch.

This seems so cumbersome than another alternative would actually to clone the Github repo and apply git commands on that local clone!
(mainly git shortlog)


Note: you can also checkout that python script created by Arcsector.

这篇关于github api:如何高效地找到存储库的提交数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆