Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-4894

Display auto-merge status using REST API.

    XMLWordPrintable

Details

    • 7
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      There is a undocumented way (below) to determine if a branch is configured to auto-merge in branch modelling using REST API. This information can help developers to use scripts to control their branches.

      It should be documented.

       

      Workaround:

      There is a method for determining, and changing the Auto Merge State of a repository. This is an internal REST API that we don't have published. It hasn't been refined for public use, but it should work for what you're looking for.

      Get Auto Merge Current State
      curl -v -u <USER_NAME>:<PASSWORD> -X GET -H "Content-Type: application/json" "http://localhost:7990/bitbucket/rest/branch-utils/1.0/projects/{PROJECT_KEY}/repos/{REPO_SLUG}/automerge/enabled"
      A return code of 404 indicates that Auto Merge is Disabled

      Response: Auto Merge Not Enabled

      > Content-Type: application/json
      >
      < HTTP/1.1 404 Not Found
      < Server: Apache-Coyote/1.1
      
      A return code of 200 indicated that Auto Merge is Enabled

      Response: Auto Merge Enabled

      < HTTP/1.1 200 
      < X-AREQUESTID: @4KCVEWx1043x453x0
      

      This is true even if the repository is enabled/ disabled at the project level.

      Enable Auto Merge
      curl -v -u <USER_NAME>:<PASSWORD> -X POST -H "Content-Type: application/json" "http://localhost:7990/bitbucket/rest/branch-utils/1.0/projects/{PROJECT_KEY}/repos/{REPO_SLUG}/automerge/enabled"
      Disable Auto Merge
      curl -v -u <USER_NAME>:<PASSWORD> -X DELETE -H "Content-Type: application/json" "http://localhost:7990/bitbucket/rest/branch-utils/1.0/projects/{PROJECT_KEY}/repos/{REPO_SLUG}/automerge/enabled"

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cyoshioka CelsoA
              Votes:
              8 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: