Documentation ¶
Index ¶
- func DeletePreviousRunState()
- func Run(runState *RunState)
- func SaveRunState(runState *RunState)
- type AbortMergeBranchStep
- type AbortRebaseBranchStep
- type AddToPerennialBranches
- type ChangeDirectoryStep
- type CheckoutBranchStep
- type CommitOpenChangesStep
- type ContinueMergeBranchStep
- type ContinueRebaseBranchStep
- type CreateBranchStep
- type CreatePullRequestStep
- type CreateRemoteBranchStep
- type CreateTrackingBranchStep
- type DeleteLocalBranchStep
- type DeleteParentBranchStep
- type DeleteRemoteBranchStep
- type DiscardOpenChangesStep
- type DriverMergePullRequestStep
- func (step *DriverMergePullRequestStep) CreateAbortStep() Step
- func (step *DriverMergePullRequestStep) CreateUndoStepAfterRun() Step
- func (step *DriverMergePullRequestStep) GetAutomaticAbortErrorMessage() string
- func (step *DriverMergePullRequestStep) Run() error
- func (step *DriverMergePullRequestStep) ShouldAutomaticallyAbortOnError() bool
- type EnsureHasShippableChangesStep
- type FetchUpstreamStep
- type JSONStep
- type MergeBranchStep
- type NoOpStep
- func (step *NoOpStep) CreateAbortStep() Step
- func (step *NoOpStep) CreateContinueStep() Step
- func (step *NoOpStep) CreateUndoStepAfterRun() Step
- func (step *NoOpStep) CreateUndoStepBeforeRun() Step
- func (step *NoOpStep) GetAutomaticAbortErrorMessage() string
- func (step *NoOpStep) Run() error
- func (step *NoOpStep) ShouldAutomaticallyAbortOnError() bool
- type PreserveCheckoutHistoryStep
- type PullBranchStep
- type PushBranchAfterCurrentBranchSteps
- type PushBranchStep
- type PushTagsStep
- type RebaseBranchStep
- type RemoveFromPerennialBranches
- type ResetToShaStep
- type RestoreOpenChangesStep
- type RevertCommitStep
- type RunState
- func (runState *RunState) AddPushBranchStepAfterCurrentBranchSteps()
- func (runState *RunState) CreateAbortRunState() (result RunState)
- func (runState *RunState) CreateSkipRunState() (result RunState)
- func (runState *RunState) CreateUndoRunState() (result RunState)
- func (runState *RunState) IsUnfinished() bool
- func (runState *RunState) MarkAsFinished()
- func (runState *RunState) MarkAsUnfinished()
- func (runState *RunState) SkipCurrentBranchSteps()
- type SetParentBranchStep
- type SkipCurrentBranchSteps
- type SquashMergeBranchStep
- func (step *SquashMergeBranchStep) CreateAbortStep() Step
- func (step *SquashMergeBranchStep) CreateUndoStepAfterRun() Step
- func (step *SquashMergeBranchStep) GetAutomaticAbortErrorMessage() string
- func (step *SquashMergeBranchStep) Run() error
- func (step *SquashMergeBranchStep) ShouldAutomaticallyAbortOnError() bool
- type StashOpenChangesStep
- type Step
- type StepList
- func (stepList *StepList) Append(step Step)
- func (stepList *StepList) AppendList(otherList StepList)
- func (stepList *StepList) MarshalJSON() (b []byte, e error)
- func (stepList *StepList) Peek() (result Step)
- func (stepList *StepList) Pop() (result Step)
- func (stepList *StepList) Prepend(step Step)
- func (stepList *StepList) PrependList(otherList StepList)
- func (stepList *StepList) UnmarshalJSON(b []byte) error
- func (stepList *StepList) Wrap(options WrapOptions)
- type UnfinishedRunStateDetails
- type WrapOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeletePreviousRunState ¶
func DeletePreviousRunState()
DeletePreviousRunState deletes the previous run state from disk
Types ¶
type AbortMergeBranchStep ¶
type AbortMergeBranchStep struct {
NoOpStep
}
AbortMergeBranchStep aborts the current merge conflict.
func (*AbortMergeBranchStep) Run ¶
func (step *AbortMergeBranchStep) Run() error
Run executes this step.
type AbortRebaseBranchStep ¶
type AbortRebaseBranchStep struct {
NoOpStep
}
AbortRebaseBranchStep represents aborting on ongoing merge conflict. This step is used in the abort scripts for Git Town commands.
func (*AbortRebaseBranchStep) Run ¶
func (step *AbortRebaseBranchStep) Run() error
Run executes this step.
type AddToPerennialBranches ¶
AddToPerennialBranches adds the branch with the given name as a perennial branch
func (*AddToPerennialBranches) CreateUndoStepBeforeRun ¶
func (step *AddToPerennialBranches) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*AddToPerennialBranches) Run ¶
func (step *AddToPerennialBranches) Run() error
Run executes this step.
type ChangeDirectoryStep ¶
ChangeDirectoryStep changes the current working directory.
func (*ChangeDirectoryStep) CreateUndoStepBeforeRun ¶
func (step *ChangeDirectoryStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*ChangeDirectoryStep) Run ¶
func (step *ChangeDirectoryStep) Run() error
Run executes this step.
type CheckoutBranchStep ¶
CheckoutBranchStep checks out a new branch.
func (*CheckoutBranchStep) CreateUndoStepBeforeRun ¶
func (step *CheckoutBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*CheckoutBranchStep) Run ¶
func (step *CheckoutBranchStep) Run() error
Run executes this step.
type CommitOpenChangesStep ¶
type CommitOpenChangesStep struct {
NoOpStep
}
CommitOpenChangesStep commits all open changes as a new commit. It does not ask the user for a commit message, but chooses one automatically.
func (*CommitOpenChangesStep) CreateUndoStepBeforeRun ¶
func (step *CommitOpenChangesStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*CommitOpenChangesStep) Run ¶
func (step *CommitOpenChangesStep) Run() error
Run executes this step.
type ContinueMergeBranchStep ¶
type ContinueMergeBranchStep struct {
NoOpStep
}
ContinueMergeBranchStep finishes an ongoing merge conflict assuming all conflicts have been resolved by the user.
func (*ContinueMergeBranchStep) CreateAbortStep ¶
func (step *ContinueMergeBranchStep) CreateAbortStep() Step
CreateAbortStep returns the abort step for this step.
func (*ContinueMergeBranchStep) CreateContinueStep ¶
func (step *ContinueMergeBranchStep) CreateContinueStep() Step
CreateContinueStep returns the continue step for this step.
func (*ContinueMergeBranchStep) Run ¶
func (step *ContinueMergeBranchStep) Run() error
Run executes this step.
type ContinueRebaseBranchStep ¶
type ContinueRebaseBranchStep struct {
NoOpStep
}
ContinueRebaseBranchStep finishes an ongoing rebase operation assuming all conflicts have been resolved by the user.
func (*ContinueRebaseBranchStep) CreateAbortStep ¶
func (step *ContinueRebaseBranchStep) CreateAbortStep() Step
CreateAbortStep returns the abort step for this step.
func (*ContinueRebaseBranchStep) CreateContinueStep ¶
func (step *ContinueRebaseBranchStep) CreateContinueStep() Step
CreateContinueStep returns the continue step for this step.
func (*ContinueRebaseBranchStep) Run ¶
func (step *ContinueRebaseBranchStep) Run() error
Run executes this step.
type CreateBranchStep ¶
CreateBranchStep creates a new branch but leaves the current branch unchanged.
func (*CreateBranchStep) CreateUndoStepBeforeRun ¶
func (step *CreateBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
type CreatePullRequestStep ¶
CreatePullRequestStep creates a new pull request for the current branch.
func (*CreatePullRequestStep) Run ¶
func (step *CreatePullRequestStep) Run() error
Run executes this step.
type CreateRemoteBranchStep ¶
CreateRemoteBranchStep pushes the current branch up to origin.
func (*CreateRemoteBranchStep) Run ¶
func (step *CreateRemoteBranchStep) Run() error
Run executes this step.
type CreateTrackingBranchStep ¶
CreateTrackingBranchStep pushes the current branch up to origin and marks it as tracking the current branch.
func (*CreateTrackingBranchStep) CreateUndoStepBeforeRun ¶
func (step *CreateTrackingBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*CreateTrackingBranchStep) Run ¶
func (step *CreateTrackingBranchStep) Run() error
Run executes this step.
type DeleteLocalBranchStep ¶
DeleteLocalBranchStep deletes the branch with the given name, optionally in a safe or unsafe way.
func (*DeleteLocalBranchStep) CreateUndoStepBeforeRun ¶
func (step *DeleteLocalBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*DeleteLocalBranchStep) Run ¶
func (step *DeleteLocalBranchStep) Run() error
Run executes this step.
type DeleteParentBranchStep ¶
DeleteParentBranchStep removes the parent branch entry in the Git Town configuration.
func (*DeleteParentBranchStep) CreateUndoStepBeforeRun ¶
func (step *DeleteParentBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*DeleteParentBranchStep) Run ¶
func (step *DeleteParentBranchStep) Run() error
Run executes this step.
type DeleteRemoteBranchStep ¶
DeleteRemoteBranchStep deletes the current branch from the origin remote.
func (*DeleteRemoteBranchStep) CreateUndoStepBeforeRun ¶
func (step *DeleteRemoteBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*DeleteRemoteBranchStep) Run ¶
func (step *DeleteRemoteBranchStep) Run() error
Run executes this step.
type DiscardOpenChangesStep ¶
type DiscardOpenChangesStep struct {
NoOpStep
}
DiscardOpenChangesStep resets the branch to the last commit, discarding uncommitted changes.
func (*DiscardOpenChangesStep) Run ¶
func (step *DiscardOpenChangesStep) Run() error
Run executes this step.
type DriverMergePullRequestStep ¶
type DriverMergePullRequestStep struct { NoOpStep BranchName string CommitMessage string DefaultCommitMessage string // contains filtered or unexported fields }
DriverMergePullRequestStep squash merges the branch with the given name into the current branch
func (*DriverMergePullRequestStep) CreateAbortStep ¶
func (step *DriverMergePullRequestStep) CreateAbortStep() Step
CreateAbortStep returns the abort step for this step.
func (*DriverMergePullRequestStep) CreateUndoStepAfterRun ¶
func (step *DriverMergePullRequestStep) CreateUndoStepAfterRun() Step
CreateUndoStepAfterRun returns the undo step for this step after it is run.
func (*DriverMergePullRequestStep) GetAutomaticAbortErrorMessage ¶
func (step *DriverMergePullRequestStep) GetAutomaticAbortErrorMessage() string
GetAutomaticAbortErrorMessage returns the error message to display when this step cause the command to automatically abort.
func (*DriverMergePullRequestStep) Run ¶
func (step *DriverMergePullRequestStep) Run() error
Run executes this step.
func (*DriverMergePullRequestStep) ShouldAutomaticallyAbortOnError ¶
func (step *DriverMergePullRequestStep) ShouldAutomaticallyAbortOnError() bool
ShouldAutomaticallyAbortOnError returns whether this step should cause the command to automatically abort if it errors.
type EnsureHasShippableChangesStep ¶
EnsureHasShippableChangesStep asserts that the branch has unique changes not on the main branch
func (*EnsureHasShippableChangesStep) GetAutomaticAbortErrorMessage ¶
func (step *EnsureHasShippableChangesStep) GetAutomaticAbortErrorMessage() string
GetAutomaticAbortErrorMessage returns the error message to display when this step cause the command to automatically abort.
func (*EnsureHasShippableChangesStep) Run ¶
func (step *EnsureHasShippableChangesStep) Run() error
Run executes this step.
func (*EnsureHasShippableChangesStep) ShouldAutomaticallyAbortOnError ¶
func (step *EnsureHasShippableChangesStep) ShouldAutomaticallyAbortOnError() bool
ShouldAutomaticallyAbortOnError returns whether this step should cause the command to automatically abort if it errors.
type FetchUpstreamStep ¶
FetchUpstreamStep brings the Git history of the local repository up to speed with activities that happened in the upstream remote.
type JSONStep ¶
type JSONStep struct {
Step Step
}
JSONStep is used to store a step in JSON
func (*JSONStep) MarshalJSON ¶
MarshalJSON marshals the step to JSON
func (*JSONStep) UnmarshalJSON ¶
UnmarshalJSON unmarshals the step from JSON nolint: gocyclo
type MergeBranchStep ¶
MergeBranchStep merges the branch with the given name into the current branch
func (*MergeBranchStep) CreateAbortStep ¶
func (step *MergeBranchStep) CreateAbortStep() Step
CreateAbortStep returns the abort step for this step.
func (*MergeBranchStep) CreateContinueStep ¶
func (step *MergeBranchStep) CreateContinueStep() Step
CreateContinueStep returns the continue step for this step.
func (*MergeBranchStep) CreateUndoStepBeforeRun ¶
func (step *MergeBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
type NoOpStep ¶
type NoOpStep struct{}
NoOpStep does nothing. It is used for steps that have no undo or abort steps.
func (*NoOpStep) CreateAbortStep ¶
CreateAbortStep returns the abort step for this step.
func (*NoOpStep) CreateContinueStep ¶
CreateContinueStep returns the continue step for this step.
func (*NoOpStep) CreateUndoStepAfterRun ¶
CreateUndoStepAfterRun returns the undo step for this step after it is run.
func (*NoOpStep) CreateUndoStepBeforeRun ¶
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*NoOpStep) GetAutomaticAbortErrorMessage ¶
GetAutomaticAbortErrorMessage returns the error message to display when this step cause the command to automatically abort.
func (*NoOpStep) ShouldAutomaticallyAbortOnError ¶
ShouldAutomaticallyAbortOnError returns whether this step should cause the command to automatically abort if it errors.
type PreserveCheckoutHistoryStep ¶
type PreserveCheckoutHistoryStep struct { NoOpStep InitialBranch string InitialPreviouslyCheckedOutBranch string }
PreserveCheckoutHistoryStep does stuff
func (*PreserveCheckoutHistoryStep) Run ¶
func (step *PreserveCheckoutHistoryStep) Run() error
Run executes this step.
type PullBranchStep ¶
PullBranchStep pulls the branch with the given name from the origin remote
type PushBranchAfterCurrentBranchSteps ¶
type PushBranchAfterCurrentBranchSteps struct {
NoOpStep
}
PushBranchAfterCurrentBranchSteps is a mock step that is used in the undo process to push the branch after other steps have been undone.
type PushBranchStep ¶
PushBranchStep pushes the branch with the given name to the origin remote. Optionally with force.
func (*PushBranchStep) CreateUndoStepBeforeRun ¶
func (step *PushBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
type PushTagsStep ¶
type PushTagsStep struct {
NoOpStep
}
PushTagsStep pushes newly created Git tags to the remote.
type RebaseBranchStep ¶
RebaseBranchStep rebases the current branch against the branch with the given name.
func (*RebaseBranchStep) CreateAbortStep ¶
func (step *RebaseBranchStep) CreateAbortStep() Step
CreateAbortStep returns the abort step for this step.
func (*RebaseBranchStep) CreateContinueStep ¶
func (step *RebaseBranchStep) CreateContinueStep() Step
CreateContinueStep returns the continue step for this step.
func (*RebaseBranchStep) CreateUndoStepBeforeRun ¶
func (step *RebaseBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
type RemoveFromPerennialBranches ¶
RemoveFromPerennialBranches removes the branch with the given name as a perennial branch
func (*RemoveFromPerennialBranches) CreateUndoStepBeforeRun ¶
func (step *RemoveFromPerennialBranches) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*RemoveFromPerennialBranches) Run ¶
func (step *RemoveFromPerennialBranches) Run() error
Run executes this step.
type ResetToShaStep ¶
ResetToShaStep undoes all commits on the current branch all the way until the given SHA.
type RestoreOpenChangesStep ¶
type RestoreOpenChangesStep struct {
NoOpStep
}
RestoreOpenChangesStep restores stashed away changes into the workspace.
func (*RestoreOpenChangesStep) CreateUndoStepBeforeRun ¶
func (step *RestoreOpenChangesStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*RestoreOpenChangesStep) Run ¶
func (step *RestoreOpenChangesStep) Run() error
Run executes this step.
type RevertCommitStep ¶
RevertCommitStep reverts the commit with the given sha.
type RunState ¶
type RunState struct { AbortStepList StepList Command string IsAbort bool UnfinishedDetails *UnfinishedRunStateDetails RunStepList StepList UndoStepList StepList // contains filtered or unexported fields }
RunState represents the current state of a Git Town command, including which operations are left to do, and how to undo what has ben done so far.
func LoadPreviousRunState ¶
func LoadPreviousRunState() *RunState
LoadPreviousRunState loads the run state from disk if it exists or creates a new run state
func NewRunState ¶
NewRunState returns a new run state
func (*RunState) AddPushBranchStepAfterCurrentBranchSteps ¶
func (runState *RunState) AddPushBranchStepAfterCurrentBranchSteps()
AddPushBranchStepAfterCurrentBranchSteps inserts a PushBranchStep after all the steps for the current branch
func (*RunState) CreateAbortRunState ¶
CreateAbortRunState returns a new runstate to be run to aborting and undoing the Git Town command represented by this runstate.
func (*RunState) CreateSkipRunState ¶
CreateSkipRunState returns a new Runstate that skips operations for the current branch.
func (*RunState) CreateUndoRunState ¶
CreateUndoRunState returns a new runstate to be run when undoing the Git Town command represented by this runstate.
func (*RunState) IsUnfinished ¶
IsUnfinished returns whether or not the run state is unfinished
func (*RunState) MarkAsFinished ¶
func (runState *RunState) MarkAsFinished()
MarkAsFinished updates the run state to be marked as finished
func (*RunState) MarkAsUnfinished ¶
func (runState *RunState) MarkAsUnfinished()
MarkAsUnfinished updates the run state to be marked as unfinished and populates informational fields
func (*RunState) SkipCurrentBranchSteps ¶
func (runState *RunState) SkipCurrentBranchSteps()
SkipCurrentBranchSteps removes the steps for the current branch from this run state.
type SetParentBranchStep ¶
SetParentBranchStep registers the branch with the given name as a parent of the branch with the other given name.
func (*SetParentBranchStep) CreateUndoStepBeforeRun ¶
func (step *SetParentBranchStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*SetParentBranchStep) Run ¶
func (step *SetParentBranchStep) Run() error
Run executes this step.
type SkipCurrentBranchSteps ¶
type SkipCurrentBranchSteps struct {
NoOpStep
}
SkipCurrentBranchSteps is a mock step to be used instead of running another list of steps. This is used when ignoring the remaining steps for a particular branch.
type SquashMergeBranchStep ¶
SquashMergeBranchStep squash merges the branch with the given name into the current branch
func (*SquashMergeBranchStep) CreateAbortStep ¶
func (step *SquashMergeBranchStep) CreateAbortStep() Step
CreateAbortStep returns the abort step for this step.
func (*SquashMergeBranchStep) CreateUndoStepAfterRun ¶
func (step *SquashMergeBranchStep) CreateUndoStepAfterRun() Step
CreateUndoStepAfterRun returns the undo step for this step after it is run.
func (*SquashMergeBranchStep) GetAutomaticAbortErrorMessage ¶
func (step *SquashMergeBranchStep) GetAutomaticAbortErrorMessage() string
GetAutomaticAbortErrorMessage returns the error message to display when this step cause the command to automatically abort.
func (*SquashMergeBranchStep) Run ¶
func (step *SquashMergeBranchStep) Run() error
Run executes this step.
func (*SquashMergeBranchStep) ShouldAutomaticallyAbortOnError ¶
func (step *SquashMergeBranchStep) ShouldAutomaticallyAbortOnError() bool
ShouldAutomaticallyAbortOnError returns whether this step should cause the command to automatically abort if it errors.
type StashOpenChangesStep ¶
type StashOpenChangesStep struct {
NoOpStep
}
StashOpenChangesStep stores all uncommitted changes on the Git stash.
func (*StashOpenChangesStep) CreateUndoStepBeforeRun ¶
func (step *StashOpenChangesStep) CreateUndoStepBeforeRun() Step
CreateUndoStepBeforeRun returns the undo step for this step before it is run.
func (*StashOpenChangesStep) Run ¶
func (step *StashOpenChangesStep) Run() error
Run executes this step.
type Step ¶
type Step interface { CreateAbortStep() Step CreateContinueStep() Step CreateUndoStepBeforeRun() Step CreateUndoStepAfterRun() Step GetAutomaticAbortErrorMessage() string Run() error ShouldAutomaticallyAbortOnError() bool }
Step represents a dedicated activity within a Git Town command. Git Town commands are comprised of a number of steps that need to be executed.
type StepList ¶
type StepList struct {
List []Step
}
StepList is a list of steps with convenience functions for adding and removing steps.
func GetSyncBranchSteps ¶
GetSyncBranchSteps returns the steps to sync the branch with the given name.
func (*StepList) AppendList ¶
AppendList adds all elements of the given StepList to the end of this StepList.
func (*StepList) MarshalJSON ¶
MarshalJSON marshals the step list to JSON
func (*StepList) PrependList ¶
PrependList adds all elements of the given StepList to the start of this StepList.
func (*StepList) UnmarshalJSON ¶
UnmarshalJSON unmarshals the step list from JSON
func (*StepList) Wrap ¶
func (stepList *StepList) Wrap(options WrapOptions)
Wrap wraps the list with steps that change to the Git root directory or stash away open changes.
type UnfinishedRunStateDetails ¶
UnfinishedRunStateDetails has details about an unfinished run state
type WrapOptions ¶
WrapOptions represents the options given to Wrap.
Source Files ¶
- abort_merge_branch_step.go
- abort_rebase_branch_step.go
- add_to_perennial_branch.go
- change_directory_step.go
- checkout_branch_step.go
- commit_open_changes_step.go
- continue_merge_branch_step.go
- continue_rebase_branch_step.go
- create_branch_step.go
- create_pull_request_step.go
- create_remote_branch_step.go
- create_tracking_branch_step.go
- delete_local_branch_step.go
- delete_parent_branch_step.go
- delete_remote_branch_step.go
- discard_open_changes_step.go
- driver_merge_pull_request_step.go
- ensure_has_shippable_changes_step.go
- fetch_upstream_step.go
- json_step.go
- merge_branch_step.go
- no_op_step.go
- preserve_checkout_history_step.go
- pull_branch_step.go
- push_branch_after_current_branch_step.go
- push_branch_step.go
- push_tags_step.go
- rebase_branch_step.go
- remove_from_perennial_branch.go
- reset_to_sha_step.go
- restore_open_changes_step.go
- revert_commit_step.go
- run.go
- run_state.go
- run_state_to_disk.go
- set_parent_branch_step.go
- skip_current_branch_steps.go
- squash_merge_branch_step.go
- stash_open_changes_step.go
- step.go
- step_list.go
- sync_steps.go