我可以使用 REST API 在 Atlassian Stash 中设置分支模型吗?

Can I setup Branching Model in Atlassian Stash with REST API?

我正在编写脚本以使用 REST API 在 git 和 Atlassian Stash(又名 Bitbucket 服务器)上设置训练环境。 我正在创建项目和存储库,填充存储库...

我也想在该脚本中为我的存储库配置 'Branching Model'。

我还没有找到如何通过 REST API 做到这一点。 我错过了什么?

我正在使用 Atlassian Stash v3.2.4

提前致谢。

Unfortunately there's not a REST API at the moment. It's somerhing we'd like to add in a future version but it's not on the short term roadmap yet.

That said, Stash 3.2 is around 18 months old and I'd highly recommend upgrading to Bitbucket Server 4.x (Stash was renamed at 4.0), there are lots of improvements in the 17 releases (so far) since then.

(如果它可以帮助某人)

我已经能够在 Stash/Bitbucket 服务器上设置分支模型(Stash v3.11.2,Bitbucket 4.8.3,我还没有测试过其他版本):

  $CURL -X PUT -H 'Content-Type: application/json'                                       \
    -d '{"development":{"refId":"refs/heads/develop", "useDefault":false},               \
         "production":{"refId":"refs/heads/master","useDefault":false},                  \
         "types":[                                                                       \
            {"id":"BUGFIX","displayName":"Bugfix","enabled":true,"prefix":"bugfix/"},    \
            {"id":"FEATURE","displayName":"Feature","enabled":true,"prefix":"feature/"}, \
            {"id":"HOTFIX","displayName":"Hotfix","enabled":true,"prefix":"hotfixme/"},  \
            {"id":"RELEASE","displayName":"Release","enabled":true,"prefix":"release/"}  \
           ]}' \
        ${SERVER}/rest/branch-utils/1.0/projects/$key/repos/$slug/branchmodel/configuration

$CURLcurl -s -u USER:PASSWORD(以及其他一些选项,例如 -k --noproxy...)
$SERVER: URL 到服务器
$key: 项目密钥
$slug:存储库的 slug(~ 名称)

希望这对您有所帮助...

干杯。