bitbucket - Bitbucket rest api 获取任何两个分支之间存在的提交差异
问题描述
我正在尝试获取两个分支之间存在的提交差异列表以用于报告目的。假设我需要找出发布分支中存在的提交,而不是 prod 分支中的提交。所以为此我需要一个来自bitbucket的rest api,它将获取提交的差异。有什么帮助吗??https://bitbucket-xxx/rest/api/1.0/projects/MyProject/repos/repos1/compare/diff?from=release&to=prod
但它没有给出正确的输出。我想我没有使用适当的休息 api。
解决方案
我不确定 Bitbucket Server 版本,但对于 Cloud 版本,有一个 API 可以为您提供不同的提交。
curl --url "https://api.bitbucket.org/2.0/repositories/workspace/repository_name/commits/source_branch?exclude=destination_branch" --user username:password --request GET --header "Accept: application/json"
因此,您可以将源作为发布分支,将目标作为生产分支。此调用将为您提供源中存在但目标中不存在的一组提交。如果响应为空,则源中的所有提交都存在于目标中
推荐阅读
- sql - 来自一个表的 SQL 查询结果,其中某些值存在于不同的表中
- ruby-on-rails - Rails 6在渲染中传递参数:保存失败后的新参数
- amazon-web-services - 我可以在 aws lambda 中部署多类 java jar 还是应该始终是 lambda 中推荐的单个类文件?
- python - Python on_member_join 无法与不和谐机器人一起使用
- python - 如果组成它的元组的任何项目不在数据框中,则删除字典键
- python - 索引错误;列表索引超出范围
- javascript - 如何使用 Cloud Function 获取 Firestore 集合?
- reactjs - 在这种情况下如何编写正确的单元测试
- javascript - 如何在继续嵌套承诺之前让代码等待响应?
- c++ - CustomDial 小部件导致分段错误