问题描述
我正在构建一个应用程序,该应用程序需要来自 git commits 的所有提交注释对远程源上的分支.我们的存储库托管在 BitBucket 服务器上,是一个 Git 存储库.
我查看了 Bitbucket (Stash) REST api,我可以通过浏览提交来恢复 git 注释,如下所示:
https://mybitbucket.local/rest/api/1.0/projects/myslug/repos/myproduct/commits?limit=1000&branch=mybranch
为了提高效率,我现在需要的是一种从两个标签之间请求内容的机制.这可能吗?我想提供两个标签作为参数,比如 &fromTag=X&toTag=y...
我找不到这个,而且文档有点稀疏...... :(
有办法吗?
参见 Bitbucket Server 的
在这种情况下,与AUI-1546"匹配的 5 个提交是我上面的示例提交/比较"REST API 调用返回的那些.你可以在这张图上很清楚地看到它们是 1.) 可从 a6e64f4fd0e
访问和 2.) 不能从 master
访问的 5 次提交.
I am building an app to which requires all the commit comments from git commits against a branch on remote origin. Our repository is hosted on a BitBucket server and is a Git repository.
I have looked over the Bitbucket (Stash) REST api and I can bring back the git comments by browsing the commits, something like this:
https://mybitbucket.local/rest/api/1.0/projects/myslug/repos/myproduct/commits?limit=1000&branch=mybranch
What I need now, just to make it more efficient, is a mechanism to request the content from just between two tags. Is this possible? I imagine providing two tags as parameters, like &fromTag=X&toTag=y...
I cannot find this, and the documentation is a little sparse... :(
Is there a way?
See Bitbucket Server's "compare/commits" REST API call:
/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/compare/commits
"Gets the commits accessible from the {@code from} commit but not in the {@code to} commit."
Here's an example call against my demo server (probably need to login as user "test" with pass "test" first) that returns with 5 commits that can be seen from a6e64f4fd0e
but are not visible from master
:
Since you're using Bitbucket/Stash, you might be interested in my Bit-Booster Commit Graph and More add-on to visually verify the correct commits are being returned, like so:
In this case the 5 commits that match "AUI-1546" are the ones my example "commits/compare" REST API call above is returning. You can see quite clearly on this graph how they are precisely the 5 commits that are 1.) accessible from a6e64f4fd0e
and 2.) not accessible from master
.
这篇关于Bitbucket REST接口和GIT;如何从分支中获取两个标签之间的日志历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!