semantic_release.hvcs.bitbucket module#

Helper code for interacting with a Bitbucket remote VCS

class semantic_release.hvcs.bitbucket.Bitbucket(remote_url: str, *, hvcs_domain: str | None = None, hvcs_api_domain: str | None = None, token: str | None = None, allow_insecure: bool = False, **kwargs: Any)[source]#

Bases: HvcsBase

Bitbucket HVCS interface for interacting with BitBucket repositories

This class supports the following products:

  • BitBucket Cloud

  • BitBucket Data Center Server (on-premises installations)

This interface does its best to detect which product is configured based on the provided domain. If it is the official bitbucket.org, the default domain, then it is considered as BitBucket Cloud which uses the subdomain api.bitbucket.org/2.0 for api communication.

If the provided domain is anything else, than it is assumed to be communicating with an on-premise or 3rd-party maintained BitBucket instance which matches with the BitBucket Data Center Server product. The on-prem server product uses a path prefix for handling api requests which is configured to be server.domain/rest/api/1.0 based on the documentation in April 2024.

DEFAULT_API_DOMAIN = 'api.bitbucket.org'#
DEFAULT_API_PATH_CLOUD = '/2.0'#
DEFAULT_API_PATH_ONPREM = '/rest/api/1.0'#
DEFAULT_API_SUBDOMAIN_PREFIX = 'api'#
DEFAULT_DOMAIN = 'bitbucket.org'#
DEFAULT_ENV_TOKEN_NAME = 'BITBUCKET_TOKEN'#
commit_hash_url(commit_hash: str) str[source]#

Given a commit hash, return a web URL which links to this commit in the remote VCS.

compare_url(from_rev: str, to_rev: str) str[source]#

Get the Bitbucket comparison link between two version tags. :param from_rev: The older version to compare. :param to_rev: The newer version to compare. :return: Link to view a comparison between the two versions.

create_api_url(endpoint: str, auth: str | None = None, query: str | None = None, fragment: str | None = None) str[source]#
create_server_url(path: str, auth: str | None = None, query: str | None = None, fragment: str | None = None) str[source]#
pull_request_url(pr_number: str | int) str[source]#

Given a number for a PR/Merge request/equivalent, return a web URL that links to that PR in the remote VCS.

remote_url(use_token: bool = True) str[source]#

Get the remote url including the token for authentication if requested