Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRepoNotInitialized = errors.New("this repository not initialized: please run `av init`")
Functions ¶
func ReadAllBranches ¶
ReadAllBranches fetches all branch metadata stored in the git repository. It returns a map where the key is the name of the branch.
func WriteBranch ¶
WriteBranch writes branch metadata to the git repository. It can be loaded again with ReadBranch.
func WriteRepository ¶
func WriteRepository(repo *git.Repo, meta Repository) error
WriteRepository writes repository metadata to the git repo. It can be loaded again with ReadRepository.
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:"-"` // 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) Parent string `json:"parent"` // The children branches of this branch within the stack (if any). Children []string `json:"children,omitempty"` // The associated pull request information, if any. PullRequest *PullRequest `json:"pullRequest,omitempty"` }
func ReadBranch ¶
ReadBranch loads information about the branch from the git repository. Returns the branch metadata and a boolean indicating if the branch metadata already existed and was loaded. If the branch metadata does not exist, a useful default is returned.
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 }
type Repository ¶
type Repository struct { // The GitHub (GraphQL) ID of the repository (e.g., R_kgDOHMmHmg). ID string `json:"id"` // The owner of the repository (e.g., aviator-co) Owner string `json:"owner"` // The name of the repository (e.g., av) Name string `json:"name"` }
func ReadRepository ¶
func ReadRepository(repo *git.Repo) (Repository, error)
ReadRepository reads repository metadata from the git repo. Returns the metadata and a boolean indicating if the metadata was found.