Documentation
¶
Overview ¶
Package commit writes file changes and pull requests through the caller's Git host identity.
Index ¶
- Constants
- Variables
- func Merge(ctx context.Context, remote Remote, pullRequest PullRequest, approved bool) error
- func Removes(changes []FileChange, path string) bool
- type AuthError
- type Change
- type ChangeKind
- type CheckState
- type Fakedeprecated
- func NewFake() *Fakedeprecated
- type FakeCommitdeprecated
- type FakePullRequestdeprecated
- type FileChange
- type GitHubdeprecated
- type GitHubOptiondeprecated
- type HeadReader
- type Lister
- type MergedFilesLister
- type OneRemote
- type PrefixFinder
- type PullRequest
- type PullRequestConflictError
- type Reader
- type Remote
- type Repository
- type RepositoryAccess
- type Request
- type ReviewState
- type Status
Constants ¶
const ( ReviewNone = commitmodel.ReviewNone ReviewApproved = commitmodel.ReviewApproved ReviewChangesRequested = commitmodel.ReviewChangesRequested ChecksNone = commitmodel.ChecksNone ChecksPending = commitmodel.ChecksPending ChecksSuccess = commitmodel.ChecksSuccess ChecksFailure = commitmodel.ChecksFailure FileAdded = commitmodel.FileAdded FileModified = commitmodel.FileModified FileRemoved = commitmodel.FileRemoved FileRenamed = commitmodel.FileRenamed OpCreateBranch = commitmodel.OpCreateBranch OpCommit = commitmodel.OpCommit OpOpenPullRequest = commitmodel.OpOpenPullRequest OpStatus = commitmodel.OpStatus OpMerge = commitmodel.OpMerge OpApprove = commitmodel.OpApprove OpFindPullRequest = commitmodel.OpFindPullRequest OpFindByPrefix = commitmodel.OpFindByPrefix OpEnableAutoMerge = commitmodel.OpEnableAutoMerge OpClose = commitmodel.OpClose OpRevert = commitmodel.OpRevert OpReadFile = commitmodel.OpReadFile OpListFiles = commitmodel.OpListFiles OpHead = commitmodel.OpHead OpMergedFiles = commitmodel.OpMergedFiles OpReadRepository = commitmodel.OpReadRepository )
Variables ¶
var ( ErrAuth = commitmodel.ErrAuth ErrInvalidRequest = commitmodel.ErrInvalidRequest ErrNoFiles = commitmodel.ErrNoFiles ErrConflictingBase = commitmodel.ErrConflictingBase ErrDuplicatePath = commitmodel.ErrDuplicatePath ErrStaleBranch = commitmodel.ErrStaleBranch ErrNotApproved = commitmodel.ErrNotApproved ErrChecksPending = commitmodel.ErrChecksPending ErrChecksFailed = commitmodel.ErrChecksFailed ErrHeadMoved = commitmodel.ErrHeadMoved ErrNotMerged = commitmodel.ErrNotMerged ErrNothingToRevert = commitmodel.ErrNothingToRevert ErrFileNotFound = commitmodel.ErrFileNotFound )
var ErrPullRequestOpen = errors.New("the object already has an open pull request")
ErrPullRequestOpen indicates that an object already has an open pull request.
Functions ¶
func Removes ¶ added in v0.12.0
func Removes(changes []FileChange, path string) bool
Types ¶
type AuthError ¶
type AuthError = commitmodel.AuthError
type Change ¶
type Change = commitmodel.Change
type ChangeKind ¶ added in v0.12.0
type ChangeKind = commitmodel.ChangeKind
type CheckState ¶
type CheckState = commitmodel.CheckState
type Fake
deprecated
type Fake = committest.Remote
Deprecated: use committest.Remote.
type FakeCommit
deprecated
type FakeCommit = committest.Commit
Deprecated: use committest.Commit.
type FakePullRequest
deprecated
type FakePullRequest = committest.PullRequest
Deprecated: use committest.PullRequest.
type FileChange ¶ added in v0.12.0
type FileChange = commitmodel.FileChange
type GitHub
deprecated
Deprecated: use github.Remote.
func NewGitHub
deprecated
func NewGitHub(token string, options ...GitHubOption) (*GitHub, error)
Deprecated: use github.New.
func NewGitHubWithClient
deprecated
added in
v0.4.0
func NewGitHubWithClient(client *http.Client, options ...GitHubOption) (*GitHub, error)
Deprecated: use github.NewWithClient.
type GitHubOption
deprecated
Deprecated: use github.Option.
func WithBaseURL
deprecated
func WithBaseURL(baseURL string) GitHubOption
Deprecated: use github.WithBaseURL.
func WithHTTPClient
deprecated
func WithHTTPClient(client *http.Client) GitHubOption
Deprecated: use github.WithHTTPClient.
type HeadReader ¶ added in v0.12.0
type HeadReader = commitmodel.HeadReader
type Lister ¶ added in v0.11.0
type Lister = commitmodel.Lister
type MergedFilesLister ¶ added in v0.12.0
type MergedFilesLister = commitmodel.MergedFilesLister
type OneRemote ¶
type OneRemote interface {
Remote
PrefixFinder
}
OneRemote can find competing pull requests as well as open a new one.
type PrefixFinder ¶ added in v0.12.0
type PrefixFinder = commitmodel.PrefixFinder
type PullRequest ¶
type PullRequest = commitmodel.PullRequest
func OpenOne ¶
func OpenOne(ctx context.Context, remote OneRemote, object string, request Request, changes []Change) (PullRequest, error)
OpenOne opens a pull request only when object has no open pull request in the repository. object is a stable branch-name prefix without underscores; request.Branch is ignored. Rendered files are never joined into an existing pull request because their source revision may differ from its head.
The lookup and creation are not atomic. A second lookup detects competing creates and closes this call's pull request when an older one exists. Lookup failure after creation returns the created handle with an error so the caller can recover without blindly opening another pull request.
type PullRequestConflictError ¶
type PullRequestConflictError struct {
Existing PullRequest
Created PullRequest
CleanupErr error
}
PullRequestConflictError identifies the existing pull request and any newly created competitor. CleanupErr is nonnil if closing the competitor failed.
func (*PullRequestConflictError) Error ¶
func (e *PullRequestConflictError) Error() string
func (*PullRequestConflictError) Unwrap ¶
func (e *PullRequestConflictError) Unwrap() error
type Reader ¶ added in v0.9.0
type Reader = commitmodel.Reader
type Remote ¶
type Remote = commitmodel.Remote
type Repository ¶
type Repository = commitmodel.Repository
type RepositoryAccess ¶
type RepositoryAccess interface {
CanReadRepository(context.Context, Repository) (bool, error)
}
RepositoryAccess checks whether the remote's identity can read a repository.
type Request ¶
type Request = commitmodel.Request
type ReviewState ¶
type ReviewState = commitmodel.ReviewState
type Status ¶
type Status = commitmodel.Status
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
remote
Package remote holds what the commit.Remote implementations share: the names and messages of the branches, commits and pull requests they make.
|
Package remote holds what the commit.Remote implementations share: the names and messages of the branches, commits and pull requests they make. |