Documentation ¶
Overview ¶
Package hosting provides support for interacting with code hosting services. Commands like "new-pull-request", "repo", and "ship" use this package to know how to perform Git Town operations on GitHub, Gitlab, Bitbucket, etc. Drivers implement the CodeHostingDriver interface.
A good starting point is the file core.go, which defines the main data structures used in this package.
Index ¶
- func UnsupportedServiceError() error
- type BitbucketDriver
- func (d *BitbucketDriver) HostingServiceName() string
- func (d *BitbucketDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
- func (d *BitbucketDriver) MergePullRequest(options MergePullRequestOptions) (string, error)
- func (d *BitbucketDriver) NewPullRequestURL(branch, parentBranch string) (string, error)
- func (d *BitbucketDriver) RepositoryURL() string
- type Driver
- type GiteaDriver
- func (d *GiteaDriver) HostingServiceName() string
- func (d *GiteaDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
- func (d *GiteaDriver) MergePullRequest(options MergePullRequestOptions) (mergeSha string, err error)
- func (d *GiteaDriver) NewPullRequestURL(branch string, parentBranch string) (string, error)
- func (d *GiteaDriver) RepositoryURL() string
- type GithubDriver
- func (d *GithubDriver) HostingServiceName() string
- func (d *GithubDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
- func (d *GithubDriver) MergePullRequest(options MergePullRequestOptions) (mergeSha string, err error)
- func (d *GithubDriver) NewPullRequestURL(branch string, parentBranch string) (string, error)
- func (d *GithubDriver) RepositoryURL() string
- type GitlabDriver
- func (d *GitlabDriver) BaseURL() string
- func (d *GitlabDriver) HostingServiceName() string
- func (d *GitlabDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
- func (d *GitlabDriver) MergePullRequest(options MergePullRequestOptions) (mergeSha string, err error)
- func (d *GitlabDriver) NewPullRequestURL(branch, parentBranch string) (string, error)
- func (d *GitlabDriver) ProjectPath() string
- func (d *GitlabDriver) RepositoryURL() string
- type MergePullRequestOptions
- type PullRequestInfo
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 BitbucketDriver ¶
type BitbucketDriver struct {
// contains filtered or unexported fields
}
BitbucketDriver provides access to the API of Bitbucket installations.
func NewBitbucketDriver ¶
func NewBitbucketDriver(url giturl.Parts, config config, git gitRunner) *BitbucketDriver
NewBitbucketDriver provides a Bitbucket driver instance if the given repo configuration is for a Bitbucket repo, otherwise nil.
func (*BitbucketDriver) HostingServiceName ¶
func (d *BitbucketDriver) HostingServiceName() string
func (*BitbucketDriver) LoadPullRequestInfo ¶
func (d *BitbucketDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
func (*BitbucketDriver) MergePullRequest ¶
func (d *BitbucketDriver) MergePullRequest(options MergePullRequestOptions) (string, error)
func (*BitbucketDriver) NewPullRequestURL ¶
func (d *BitbucketDriver) NewPullRequestURL(branch, parentBranch string) (string, error)
func (*BitbucketDriver) RepositoryURL ¶
func (d *BitbucketDriver) RepositoryURL() string
type Driver ¶
type Driver interface { // LoadPullRequestInfo loads information about the pull request of the given branch into the given parent branch // from the code hosting provider. LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error) // NewPullRequestURL provides the URL of the page // to create a new pull request online. NewPullRequestURL(branch, parentBranch string) (string, error) // MergePullRequest merges the pull request through the hosting service API. MergePullRequest(MergePullRequestOptions) (mergeSha string, err error) // RepositoryURL provides the URL where the given repository // can be found online. RepositoryURL() string // HostingServiceName provides the name of the code hosting service. HostingServiceName() string }
Driver defines the structure of drivers for the different code hosting services.
type GiteaDriver ¶
type GiteaDriver struct {
// contains filtered or unexported fields
}
GiteaDriver provides access to the API of Gitea installations.
func NewGiteaDriver ¶
func NewGiteaDriver(url giturl.Parts, config config, log logFn) *GiteaDriver
NewGiteaDriver provides a Gitea driver instance if the given repo configuration is for a Gitea repo, otherwise nil.
func (*GiteaDriver) HostingServiceName ¶
func (d *GiteaDriver) HostingServiceName() string
func (*GiteaDriver) LoadPullRequestInfo ¶
func (d *GiteaDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
func (*GiteaDriver) MergePullRequest ¶
func (d *GiteaDriver) MergePullRequest(options MergePullRequestOptions) (mergeSha string, err error)
func (*GiteaDriver) NewPullRequestURL ¶
func (d *GiteaDriver) NewPullRequestURL(branch string, parentBranch string) (string, error)
func (*GiteaDriver) RepositoryURL ¶
func (d *GiteaDriver) RepositoryURL() string
type GithubDriver ¶
type GithubDriver struct {
// contains filtered or unexported fields
}
GithubDriver provides access to the API of GitHub installations.
func NewGithubDriver ¶
func NewGithubDriver(url giturl.Parts, config config, log logFn) *GithubDriver
NewGithubDriver provides a GitHub driver instance if the given repo configuration is for a Github repo, otherwise nil.
func (*GithubDriver) HostingServiceName ¶
func (d *GithubDriver) HostingServiceName() string
func (*GithubDriver) LoadPullRequestInfo ¶
func (d *GithubDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
func (*GithubDriver) MergePullRequest ¶
func (d *GithubDriver) MergePullRequest(options MergePullRequestOptions) (mergeSha string, err error)
func (*GithubDriver) NewPullRequestURL ¶
func (d *GithubDriver) NewPullRequestURL(branch string, parentBranch string) (string, error)
func (*GithubDriver) RepositoryURL ¶
func (d *GithubDriver) RepositoryURL() string
type GitlabDriver ¶
type GitlabDriver struct {
// contains filtered or unexported fields
}
GitlabDriver provides access to the API of GitLab installations.
func NewGitlabDriver ¶
func NewGitlabDriver(url giturl.Parts, config config, log logFn) *GitlabDriver
NewGitlabDriver provides a GitLab driver instance if the given repo configuration is for a GitLab repo, otherwise nil.
func (*GitlabDriver) BaseURL ¶ added in v7.8.0
func (d *GitlabDriver) BaseURL() string
func (*GitlabDriver) HostingServiceName ¶
func (d *GitlabDriver) HostingServiceName() string
func (*GitlabDriver) LoadPullRequestInfo ¶
func (d *GitlabDriver) LoadPullRequestInfo(branch, parentBranch string) (PullRequestInfo, error)
func (*GitlabDriver) MergePullRequest ¶
func (d *GitlabDriver) MergePullRequest(options MergePullRequestOptions) (mergeSha string, err error)
func (*GitlabDriver) NewPullRequestURL ¶
func (d *GitlabDriver) NewPullRequestURL(branch, parentBranch string) (string, error)
func (*GitlabDriver) ProjectPath ¶ added in v7.8.0
func (d *GitlabDriver) ProjectPath() string
func (*GitlabDriver) RepositoryURL ¶
func (d *GitlabDriver) RepositoryURL() string
type MergePullRequestOptions ¶
type MergePullRequestOptions struct { Branch string CommitMessage string LogRequests bool ParentBranch string PullRequestNumber int64 }
MergePullRequestOptions defines the options to the MergePullRequest function.
type PullRequestInfo ¶
type PullRequestInfo struct { CanMergeWithAPI bool DefaultCommitMessage string PullRequestNumber int64 }
PullRequestInfo contains information about a pull request.