如何使用bitbucket rest API确定与给定提交最接近的标记?

时间:2018-05-16 22:42:37

标签: bitbucket bitbucket-server

我想获得自上次发布以来的提交列表,但由于我有很多git repos需要检查,我想通过bitbucket rest API来实现,而不是克隆我想要的每个git repo测试

如果我有克隆,我的问题很简单:

#!/bin/bash

git tag | grep '<release-tag-regexp>' | sort <in-descending-order>' \
  | while read tag
    do
      tag_sha1="$(git rev-parse "$tag^{commit}")"
      ancestor="$(git merge-base HEAD $tag)"
      if [ $ancestor = $tag_sha1 ]
      then
        echo "Closest release tag is: $tag"
        exit 1
      fi
    done

 if [ $? -eq 0 ]
 then
   echo "No release tag found which is an ancestor of HEAD"
 fi

我希望bitbucket对此查询进行休息调用。看起来,我似乎别无选择,只能使用提交日志和标签列表并自己构建地图。

1 个答案:

答案 0 :(得分:0)

您无法通过REST API获取与给定提交最接近的标记。但是,如果您已有标记,则可以使用commits REST API并通过sinceuntil查询参数来获取两个标记之间的提交列表。

相关问题