cmd

package
v0.0.0-...-df17592 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorPattern = "could not %s a global gitignore file, please add .opp to your .gitignore file manually"

Variables

View Source
var (
	ErrLostPrCreationRaceCondition              = errors.New("lost race condition when creating PR")
	ErrLostPrCreationRaceConditionMultipleTimes = errors.New("lost race condition when creating PR too many times, aborting")
	ErrAlreadyAPrBranch                         = errors.New(strings.TrimSpace(`
You are on a branch that has already been pushed as a PR
Use opp up to update that PR instead.`))
	BaseFlagUsage = strings.TrimSpace(`
Specify what is the base for your PR (either the base branch or another PR).
If you leave this blank, opp is going to detect what is the right base for your PR
by walking back the history until it finds either the main branch or the tip of another PR.
`)
	CheckoutFlagUsage = strings.TrimSpace(`
By default, opp pr tries to leave you on the branch you were. Use --checkout if you want to
checkout the PR branch.
There are some cases where opp pr still checkouts the PR branch after creation: when you
specified a different base for example.
`)
	DraftFlagUsage = "Create a draft PR."
	Description    = strings.TrimSpace(`
Starting from either HEAD, or the provided reference (HEAD~1, a74c9e, a_branch, ...) and walking
back, gathers commits until it finds either the tip of a PR branch (e.g. pr/xxx) or the base branch
and creates a PR that contains these commits.

If you provide a different --base, these commits will be rebased on that new base, and if this is
a clean rebase it will create a PR targetting that base.

If you don't, it will create a PR targetting either the base branch or another PR, depending on
whether it reached the base branch or the tip of another PR first when walking back.
`)
)
View Source
var (
	ErrBeingEvaluated = errors.New("still being checked by github")
)

Functions

func CleanCommand

func CleanCommand(repo *core.Repo, gh func(context.Context) core.Gh) *cli.Command

func CloseCommand

func CloseCommand(repo *core.Repo, gh func(context.Context) core.Gh) *cli.Command

func CommentCommand

func CommentCommand(repo *core.Repo, gh func(context.Context) core.Gh) *cli.Command

func FirstAncestorCommit

func FirstAncestorCommit(repo *core.Repo, pr *core.LocalPr) (*object.Commit, error)

Returns the first commit in the history of pr that belongs to its ancestor, and does not belong to the PR.

func HeadCommit

func HeadCommit(repo *core.Repo, args cli.Args) (plumbing.Hash, error)

func InitCommand

func InitCommand(repo *core.Repo) *cli.Command

func MakeApp

func MakeApp(out io.Writer, repo *core.Repo, gh func(context.Context) core.Gh) *cli.App

func MergeCommand

func MergeCommand(repo *core.Repo, gh func(context.Context) core.Gh) *cli.Command

func PrCommand

func PrCommand(repo *core.Repo, gh func(context.Context) core.Gh) *cli.Command

func PrFromFirstArgument

func PrFromFirstArgument(repo *core.Repo, cCtx *cli.Context) (*core.LocalPr, bool, error)

PrFromFirstArgument returns the PR number supplied as a commandline argument, or if no argument is supplied, the PR for the current branch. The PR number can be supplied as a simple integer, or in the form `pr/$number`.

func PrFromStringOrCurrentBranch

func PrFromStringOrCurrentBranch(repo *core.Repo, str string) (*core.LocalPr, bool, error)

PrFromStringOrCurrentBranch returns the PR based on the given string (if non-empty), or the current branch.

func PrintFailure

func PrintFailure(err any)

func PrintSuccess

func PrintSuccess()

func PushCommand

func PushCommand(repo *core.Repo) *cli.Command

func RebaseCommand

func RebaseCommand(repo *core.Repo) *cli.Command

func SetShortMergeabilityIntervalForTests

func SetShortMergeabilityIntervalForTests() func()

func StatusCommand

func StatusCommand(out io.Writer, repo *core.Repo, gh func(context.Context) core.Gh) *cli.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

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