committest

package
v0.14.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Repository  commit.Repository
	Branch      string
	Message     string
	Parent      string
	MergeParent string
	SHA         string
	Files       map[string][]byte
}

Commit is one commit the Remote holds; Files is the full tree at that commit. MergeParent is set on the merge commit CreateBranch makes when it brings an existing branch up to date: the base's head it merged in.

type PullRequest

type PullRequest struct {
	commit.PullRequest
	Title     string
	Body      string
	Draft     bool
	Merged    bool
	Closed    bool // closed without a merge
	AutoMerge bool
	Review    commit.ReviewState
	// Approvals are the bodies of the approving reviews Approve submitted, in order.
	Approvals []string
	Checks    commit.CheckState
	// contains filtered or unexported fields
}

PullRequest is a pull request the Remote holds, with what the remote knows about it.

type Remote

type Remote struct {
	// Fail maps an operation name (OpCreateBranch, OpCommit, ...) to the error
	// that operation returns instead of acting.
	Fail map[string]error
	// contains filtered or unexported fields
}

Remote is an in-process Remote for tests — the module's own and its callers': branches with commits, pull requests with review and check state, and a way to make any operation fail. It never touches the network.

func NewRemote

func NewRemote() *Remote

NewRemote returns an empty Remote; seed base branches with AddBranch.

func (*Remote) AddBranch

func (f *Remote) AddBranch(repo commit.Repository, branch string, files map[string][]byte)

AddBranch seeds branch in repo with one commit holding files (nil for an empty tree).

func (*Remote) Approve

func (f *Remote) Approve(_ context.Context, pr commit.PullRequest, body string) error

Approve implements Remote: the approval is recorded on the pull request and the review rollup becomes approved unless changes are requested. An unknown or closed pull request is an error.

func (*Remote) Close

func (f *Remote) Close(_ context.Context, pr commit.PullRequest, deleteBranch bool) error

Close implements Remote.

func (*Remote) Commit

func (f *Remote) Commit(_ context.Context, repo commit.Repository, branch, message string, files map[string][]byte) error

Commit implements Remote.

func (*Remote) Commits

func (f *Remote) Commits(repo commit.Repository, branch string) []Commit

Commits returns the commits made on branch after its seed, oldest first.

func (*Remote) CreateBranch

func (f *Remote) CreateBranch(_ context.Context, repo commit.Repository, branch, base string) error

CreateBranch implements Remote: a new branch starts at base's head; an existing one that lacks base's head takes a merge commit with base's changes since their common ancestor, or ErrStaleBranch when a path changed on both sides differently.

func (*Remote) EnableAutoMerge

func (f *Remote) EnableAutoMerge(_ context.Context, pr commit.PullRequest) error

EnableAutoMerge implements Remote: the pull request is marked, nothing merges by itself.

func (*Remote) Files

func (f *Remote) Files(repo commit.Repository, branch string) map[string][]byte

Files returns the tree at the head of branch.

func (*Remote) FindPullRequest

func (f *Remote) FindPullRequest(_ context.Context, repo commit.Repository, head string) (commit.PullRequest, bool, error)

FindPullRequest implements Remote.

func (*Remote) FindPullRequestsByPrefix

func (f *Remote) FindPullRequestsByPrefix(_ context.Context, repo commit.Repository, prefix string) ([]commit.PullRequest, error)

FindPullRequestsByPrefix implements PrefixFinder. Every branch of the Remote is in its repository: the Remote holds no forks.

func (*Remote) Head

func (f *Remote) Head(_ context.Context, repo commit.Repository, branch string) (string, error)

Head implements HeadReader.

func (*Remote) ListFiles

func (f *Remote) ListFiles(_ context.Context, repo commit.Repository, ref, dir string) ([]string, error)

ListFiles implements Lister.

func (*Remote) Merge

func (f *Remote) Merge(_ context.Context, pr commit.PullRequest) error

Merge implements Remote: the base fast-forwards to the head.

func (*Remote) MergedFiles

func (f *Remote) MergedFiles(_ context.Context, pr commit.PullRequest) ([]commit.FileChange, error)

MergedFiles implements MergedFilesLister the way GitHub's pull request files endpoint answers: the merged head's tree against the tree at the merge base of the head and the base as it was at the merge, so another pull request merged into the base after this branch was cut is not listed. Results are sorted by path. A removed path whose exact, non-empty content an added path carries is reported as that path's rename; removed and added paths pair in path order. GitHub also detects a rename whose content changed, which the Remote reports as a removal and an addition.

func (*Remote) OpenDraftPullRequest

func (f *Remote) OpenDraftPullRequest(_ context.Context, repo commit.Repository, head, base, title, body string) (commit.PullRequest, error)

OpenDraftPullRequest implements Remote.

func (*Remote) OpenPullRequest

func (f *Remote) OpenPullRequest(_ context.Context, repo commit.Repository, head, base, title, body string) (commit.PullRequest, error)

OpenPullRequest implements Remote.

func (*Remote) PullRequests

func (f *Remote) PullRequests() []PullRequest

PullRequests returns every pull request the Remote holds, oldest first.

func (*Remote) ReadFile

func (f *Remote) ReadFile(_ context.Context, repo commit.Repository, ref, path string) ([]byte, error)

ReadFile implements Reader.

func (*Remote) Revert

func (f *Remote) Revert(_ context.Context, pr commit.PullRequest, body string, overrides map[string][]byte) (commit.PullRequest, error)

Revert implements Remote: the merged pull request's files, inverted against the base as it was at the merge, in one commit on the head of the revert branch, created at the base's tip or brought up to date with it as CreateBranch does.

func (*Remote) SetChecks

func (f *Remote) SetChecks(pr commit.PullRequest, state commit.CheckState)

SetChecks sets the check rollup the Remote reports for pr.

func (*Remote) SetReview

func (f *Remote) SetReview(pr commit.PullRequest, state commit.ReviewState)

SetReview sets the review rollup the Remote reports for pr.

func (*Remote) Status

func (f *Remote) Status(_ context.Context, pr commit.PullRequest) (commit.Status, error)

Status implements Remote.

Jump to

Keyboard shortcuts

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