bitbucket

package
v0.187.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2026 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCollaboratorFetcher

func NewCollaboratorFetcher(
	baseURL string,
	token string,
	project string,
	repo string,
	defaultBranch string,
	currentUserFetcher CurrentUserFetcher,
	allowedReviewers []string,
) git.CollaboratorFetcher

NewCollaboratorFetcher creates a git.CollaboratorFetcher backed by the Bitbucket Server default-reviewers plugin. currentUserFetcher is called lazily to exclude the current user from results. If allowedReviewers is non-empty, it is returned directly without any HTTP calls.

func NewPRCreator

func NewPRCreator(
	baseURL string,
	token string,
	project string,
	repo string,
	defaultBranch string,
	reviewerFetcher git.CollaboratorFetcher,
) git.PRCreator

NewPRCreator creates a git.PRCreator backed by the Bitbucket Server REST API. reviewerFetcher is called lazily at PR creation time to resolve the reviewer list.

func NewPRMerger

func NewPRMerger(
	baseURL string,
	token string,
	project string,
	repo string,
	currentDateTimeGetter libtime.CurrentDateTimeGetter,
) git.PRMerger

NewPRMerger creates a git.PRMerger backed by the Bitbucket Server REST API.

Types

type CurrentUserFetcher

type CurrentUserFetcher interface {
	FetchCurrentUser(ctx context.Context) string
}

CurrentUserFetcher fetches the current authenticated Bitbucket user.

func NewCurrentUserFetcher

func NewCurrentUserFetcher(baseURL, token string) CurrentUserFetcher

NewCurrentUserFetcher creates a CurrentUserFetcher for the given base URL and token.

type RemoteCoords

type RemoteCoords struct {
	// Project is the Bitbucket project key (uppercased, e.g. "BRO").
	Project string
	// Repo is the repository slug (lowercased, e.g. "sentinel").
	Repo string
}

RemoteCoords holds the project key and repo slug parsed from a Bitbucket Server remote URL.

func ParseRemoteFromGit

func ParseRemoteFromGit(
	ctx context.Context,
	runner subproc.Runner,
	remoteName string,
) (*RemoteCoords, error)

ParseRemoteFromGit reads the git remote URL for the given remote name and parses it. Uses `git remote get-url <remoteName>` to fetch the URL.

func ParseRemoteURL

func ParseRemoteURL(
	ctx context.Context,
	remoteURL string,
) (*RemoteCoords, error)

ParseRemoteURL parses a Bitbucket Server git remote URL and returns project key and repo slug.

Supported formats:

The project key is uppercased and the repo slug is lowercased (matching Bitbucket Server conventions).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL