Documentation ¶
Index ¶
- Constants
- Variables
- func AddPRMetadata(body string, prMeta PRMetadata) string
- func Push(repo *git.Repo, opts PushOpts) error
- type CreatePullRequestOpts
- type CreatePullRequestResult
- type ForceOpt
- type PRMetadata
- type PushOpts
- type ReparentOpts
- type ReparentResult
- type SyncBranchContinuation
- type SyncBranchOpts
- type UpdatePullRequestResult
Constants ¶
View Source
const PRMetadataCommentEnd = "-->\n"
View Source
const PRMetadataCommentHelpText = "" /* 165-byte string literal not displayed */
View Source
const PRMetadataCommentStart = "<!-- av pr metadata\n"
Variables ¶
View Source
var ErrRepoNotInitialized = errors.Sentinel("this repository is not initialized; please run `av init`")
Functions ¶
func AddPRMetadata ¶ added in v0.0.7
func AddPRMetadata(body string, prMeta PRMetadata) string
Types ¶
type CreatePullRequestOpts ¶
type CreatePullRequestOpts struct { BranchName string Title string Body string // If true, create the pull request as a GitHub draft PR. Draft bool // If true, do not push the branch to GitHub NoPush bool // If true, force push the branch to GitHub ForcePush bool // If true, create a PR even if we think one already exists Force bool // If true, open an editor for editing the title and body Edit bool }
type CreatePullRequestResult ¶ added in v0.0.6
type CreatePullRequestResult struct { // True if the pull request was created Created bool // The (updated) branch metadata. Branch meta.Branch // The pull request object that was returned from GitHub Pull *gh.PullRequest }
func CreatePullRequest ¶
func CreatePullRequest( ctx context.Context, repo *git.Repo, client *gh.Client, tx meta.WriteTx, opts CreatePullRequestOpts, ) (_ *CreatePullRequestResult, reterr error)
CreatePullRequest creates a pull request on GitHub for the current branch, if one doesn't already exist.
type ForceOpt ¶
type ForceOpt int
const ( NoForce ForceOpt = iota // ForceWithLease indicates that the push should use the --force-with-lease // option which instructs Git that it should only force push to the remote // branch if its current HEAD matches what we think it should be. ForceWithLease ForceOpt = iota ForcePush ForceOpt = iota )
type PRMetadata ¶ added in v0.0.7
type PRMetadata struct { Parent string `json:"parent"` ParentHead string `json:"parentHead"` ParentPull int64 `json:"parentPull,omitempty"` Trunk string `json:"trunk"` }
func ParsePRMetadata ¶ added in v0.0.7
func ParsePRMetadata(input string) (commentStart int, commentEnd int, prMeta PRMetadata, reterr error)
func ReadPRMetadata ¶ added in v0.0.7
func ReadPRMetadata(body string) (PRMetadata, error)
type PushOpts ¶
type PushOpts struct { Force ForceOpt // If true, require the corresponding branch exist on the remote (otherwise, don't push). SkipIfRemoteBranchNotExist bool // If true, skip pushing the branch if the corresponding branch on the remote points to the // same commit as the local HEAD commit. The caller should probably call `git fetch` before // running this to make sure remote tracking information is up-to-date. SkipIfRemoteBranchIsUpToDate bool }
type ReparentOpts ¶ added in v0.0.5
type ReparentResult ¶ added in v0.0.4
func Reparent ¶ added in v0.0.4
func Reparent( repo *git.Repo, tx meta.WriteTx, opts ReparentOpts, ) (*ReparentResult, error)
Reparent changes the parent branch of a stacked branch (performing a rebase if necessary).
func ReparentSkipContinue ¶ added in v0.0.15
func ReparentSkipContinue(repo *git.Repo, tx meta.WriteTx, opts ReparentOpts, skip bool) (*ReparentResult, error)
type SyncBranchContinuation ¶ added in v0.0.8
type SyncBranchContinuation struct { // The new parent name. NewParentName string `json:"parentName"` // If set, set this as the parent HEAD. If unset, the parent is treated as trunk. NewParentCommit string `json:"parentCommit"` }
func SyncBranch ¶ added in v0.0.8
func SyncBranch( ctx context.Context, repo *git.Repo, client *gh.Client, tx meta.WriteTx, opts SyncBranchOpts, ) (*SyncBranchContinuation, error)
SyncBranch synchronizes a branch with its parent.
type SyncBranchOpts ¶ added in v0.0.8
type UpdatePullRequestResult ¶ added in v0.0.4
type UpdatePullRequestResult struct { // True if the pull request information changed (e.g., a new pull request // was found or if the pull request changed state) Changed bool // The pull request object that was returned from GitHub Pull *gh.PullRequest }
func UpdatePullRequestState ¶ added in v0.0.4
func UpdatePullRequestState( ctx context.Context, client *gh.Client, tx meta.WriteTx, branchName string, ) (*UpdatePullRequestResult, error)
UpdatePullRequestState fetches the latest pull request information from GitHub and writes the relevant branch metadata.
Click to show internal directories.
Click to hide internal directories.