[英]How to fetch number of commits at Bitbucket using its API
Is there a way to fetch the number of commits through the Bitbucket API and use it in a program? 有没有一种方法可以通过Bitbucket API获取提交次数并在程序中使用它? I don't want to show any message or anything just the number of the commits by all the programmers in a section.
我不想显示任何消息或任何信息,而只显示部分中所有程序员的提交次数。
I've looked at the API documentation but still wasn't able to do it. 我看过API文档,但仍然无法做到。
You can use the following url to query the number of changesets: 您可以使用以下URL查询变更集的数量:
https://bitbucket.org/api/1.0/repositories/{account}/{repo}/changesets?limit=0
You have to change {account}
and {repo}
for the account an repository you want to know. 您必须为
{account}
更改{account}
和{repo}
您想知道的存储库。 It will return a JSON with a count
field denoting the number of commits in that repository. 它将返回带有
count
字段的JSON,该count
字段表示该存储库中的提交次数。 Remember to set the limit=0
parameter (which provides general info without listing the commits themselves). 记住要设置
limit=0
参数(该参数提供常规信息而不列出提交本身)。
To know the number of commits in the atlassian-plugins
repo from atlassian
using curl command line tool: 要使用curl命令行工具从
atlassian
知道atlassian-plugins
库中的提交次数:
$ curl "https://bitbucket.org/api/1.0/repositories/atlassian/atlassian-plugins/changesets?limit=0"
{"count": 4449, "start": null, "limit": 0, "changesets": []}
Check the first field, count, it shows that the repository has 1234
commits. 检查第一个字段count,它显示存储库具有
1234
提交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.