hosting

package
v11.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package hosting provides support for interacting with code hosting services. Commands like "propose", "repo", and "ship" use this package to know how to perform Git Town operations on GitHub, Gitlab, Bitbucket, etc. Implementations of connectors for particular code hosting platforms conform to the Connector interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnsupportedServiceError

func UnsupportedServiceError() error

UnsupportedServiceError communicates that the origin remote runs an unknown code hosting service.

Types

type Connector

type Connector interface {
	// DefaultProposalMessage provides the text that the form for creating new proposals
	// on the respective hosting platform is prepopulated with.
	DefaultProposalMessage(proposal domain.Proposal) string

	// FindProposal provides details about the proposal for the given branch into the given target branch.
	// Returns nil if no proposal exists.
	FindProposal(branch, target domain.LocalBranchName) (*domain.Proposal, error)

	// HostingServiceName provides the name of the code hosting service
	// supported by the respective connector implementation.
	HostingServiceName() string

	// SquashMergeProposal squash-merges the proposal with the given number
	// using the given commit message.
	SquashMergeProposal(number int, message string) (mergeSHA domain.SHA, err error)

	// NewProposalURL provides the URL of the page
	// to create a new proposal online.
	NewProposalURL(branch, parentBranch domain.LocalBranchName) (string, error)

	// RepositoryURL provides the URL where the current repository can be found online.
	RepositoryURL() string

	// UpdateProposalTarget updates the target branch of the given proposal.
	UpdateProposalTarget(number int, target domain.LocalBranchName) error
}

Connector describes the activities that Git Town can perform on code hosting platforms. Individual implementations exist to talk to specific hosting platforms.

func NewConnector

func NewConnector(args NewConnectorArgs) (Connector, error)

NewConnector provides an instance of the code hosting connector to use based on the given gitConfig.

type NewConnectorArgs

type NewConnectorArgs struct {
	HostingService  config.Hosting
	OriginURL       *giturl.Parts
	GetSHAForBranch common.SHAForBranchFunc
	GiteaAPIToken   string
	GithubAPIToken  string
	GitlabAPIToken  string
	MainBranch      domain.LocalBranchName
	Log             common.Log
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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