Documentation ¶
Index ¶
- func ChildrenNames(tx ReadTx, name string) []string
- func PreviousBranches(tx ReadTx, name string) ([]string, error)
- func Root(tx ReadTx, name string) (string, bool)
- func StackBranches(tx ReadTx, name string) ([]string, error)
- func StackBranchesMap(tx ReadTx, name string) (map[string]Branch, error)
- func SubsequentBranches(tx ReadTx, name string) []string
- func Trunk(tx ReadTx, name string) (string, bool)
- type Branch
- type BranchState
- type DB
- type PullRequest
- type ReadTx
- type Repository
- type WriteTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChildrenNames ¶ added in v0.0.16
func PreviousBranches ¶ added in v0.0.6
PreviousBranches finds all the ancestor branches of the given branch name in "dependency order" (i.e., A comes before B if A is an ancestor of B).
func StackBranches ¶ added in v0.0.34
StackBranches returns branches in the stack associated with the given branch.
func StackBranchesMap ¶ added in v0.0.34
StackBranchesMap returns a map of branch names to their metadata for the stack associated with the given branch.
func SubsequentBranches ¶ added in v0.0.6
SubsequentBranches finds all the child branches of the given branch name in "dependency order" (i.e., A comes before B if A is an ancestor of B). If the tree is not a straight line (which isn't explicitly supported!), the branches will be returned in depth-first traversal order.
Types ¶
type Branch ¶
type Branch struct { // The branch name associated with this stack. // Not stored in JSON because the name can always be derived from the name // of the git ref. Name string `json:"name"` // Information about the parent branch. Parent BranchState `json:"parent,omitempty"` // The associated pull request information, if any. PullRequest *PullRequest `json:"pullRequest,omitempty"` // The merge commit onto the trunk branch, if any MergeCommit string `json:"mergeCommit,omitempty"` }
func (*Branch) IsStackRoot ¶ added in v0.0.5
func (*Branch) UnmarshalJSON ¶ added in v0.0.5
type BranchState ¶ added in v0.0.5
type BranchState struct { // The branch name associated with the parent of the stack (if any). // If empty, this branch (potentially*) is considered a stack root. // (*depending on the context, we only consider the branch a stack root if // it also has children branches; for example, any "vanilla" branch off of // trunk will have no parent, but we usually don't explicitly consider it a // stack unless it also has stack children) Name string `json:"name"` // If true, consider the branch a trunk branch. A trunk branch is one that // that stacks can target for merge. Usually, the only trunk branch for a // repository is main or master. Trunk bool `json:"trunk,omitempty"` // The commit SHA of the parent's latest commit. This is used when syncing // the branch with the parent to identify the commits that belong to the // child branch (since the HEAD of the parent branch may change). // This will be unset if Trunk is true. Head string `json:"head,omitempty"` }
type PullRequest ¶
type PullRequest struct { // The GitHub (GraphQL) ID of the pull request. ID string `json:"id"` // The pull request number. Number int64 `json:"number"` // The web URL for the pull request. Permalink string `json:"permalink"` // The state of the pull request (open, closed, or merged). State githubv4.PullRequestState `json:"state"` }
func (*PullRequest) GetNumber ¶ added in v0.0.8
func (p *PullRequest) GetNumber() int64
GetNumber returns the number of the pull request or zero if the PullRequest is nil.
type ReadTx ¶ added in v0.0.15
type ReadTx interface { // Repository returns the repository information. Repository() (Repository, bool) // Branch returns the branch with the given name. If no such branch exists, // the second return value is false. Branch(name string) (Branch, bool) // AllBranches returns a map of all branches in the database. AllBranches() map[string]Branch }
ReadTx is a transaction that can be used to read from the database. It presents a consistent view of the underlying database.
type Repository ¶
type WriteTx ¶ added in v0.0.15
type WriteTx interface { ReadTx // Abort finalizes the transaction without committing any changes. // Abort can be called even after the transaction has been finalized (which // is effectively a no-op). Abort() // Commit finalizes the transaction and commits all changes. // If an error is returned, the data could not be committed. // Commit will panic if called after the transaction has been finalized. Commit() error // SetBranch sets the given branch in the database. SetBranch(branch Branch) // DeleteBranch deletes the given branch in the database. DeleteBranch(name string) // SetRepository sets the repository information in the database. SetRepository(repository Repository) }
WriteTx is a transaction that can be used to modify the database. The transaction MUST be finalized by calling either Abort or Commit.