Bitbucket REST接口和GIT;如何从分支中获取两个标签之间的日志历史记录

编程入门 行业动态 更新时间:2024-10-27 21:14:01
本文介绍了Bitbucket REST接口和GIT;如何从分支中获取两个标签之间的日志历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在构建一个应用程序,该应用程序需要来自 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:

http://vm.bit-booster/bitbucket/rest/api/1.0/projects/BB/repos/aui/compare/commits?from=a6e64f4fd0e&to=master&limit=100

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;如何从分支中获取两个标签之间的日志历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 09:37:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/936315.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:历史记录   分支   接口   两个   标签

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!