Documentation
¶
Overview ¶
Package branchmeta is the record f10 keeps on a branch, as entries under `branch.<name>.` in the repository's local config: per branch, shared by every worktree, never pushed, and deleted with the branch.
Index ¶
- Constants
- func ClearOnGreen(ctx context.Context, dir, branch string, green bool) error
- func ClearTriage(ctx context.Context, dir, branch string) error
- func Dependents(records []Record, branch string) []string
- func Get(ctx context.Context, dir, branch string, key Key) (string, error)
- func Out(ctx context.Context, dir, branch string, key Key) string
- func RecordTriage(ctx context.Context, dir, branch, sha, action string) error
- func Set(ctx context.Context, dir, branch string, key Key, value string) error
- func SetBackend(b Backend) func()
- func Unset(ctx context.Context, dir, branch string, key Key) error
- func UnsetIfSet(ctx context.Context, dir, branch string, key Key) error
- type Backend
- type DriveFinish
- type Entry
- type Git
- func (Git) All(ctx context.Context, dir string) ([]Entry, error)
- func (Git) Get(ctx context.Context, dir, branch string, key Key) (string, error)
- func (Git) Set(ctx context.Context, dir, branch string, key Key, value string) error
- func (Git) Unset(ctx context.Context, dir, branch string, key Key) error
- type Key
- type Record
- type Triage
- type Tried
Constants ¶
const ( TriedFix = "fix" TriedRerun = "rerun" // TriedLeft is the user's answer to leave a head red, or ship's note // that the default branch is red too, so no later read asks again TriedLeft = "left" )
The actions a triage records.
const ( FinishQueued = "queued" FinishRunning = "running" )
The states a DriveFinish records.
Variables ¶
This section is empty.
Functions ¶
func ClearOnGreen ¶ added in v0.60.0
ClearOnGreen ends the red spell when the head read green. Every reader calls it, since a fix counts for the branch and a record left past green would spend the next spell's fix round.
func ClearTriage ¶ added in v0.60.0
ClearTriage ends the red spell, once a head reads green.
func Dependents ¶
Dependents are the branches whose AfterBranch is branch, in order.
func Out ¶
Out is Get with a failed read taken as no record, for the callers that treat an unreadable config the way gitx.Out does.
func RecordTriage ¶ added in v0.60.0
RecordTriage adds action on sha to branch's record, refusing one the record no longer allows.
func SetBackend ¶
func SetBackend(b Backend) func()
SetBackend swaps the store, for a test that answers records without git, and returns the function that puts the previous one back.
Types ¶
type Backend ¶
type Backend interface {
Get(ctx context.Context, dir, branch string, key Key) (string, error)
Set(ctx context.Context, dir, branch string, key Key, value string) error
// Unset fails on an absent key, as git does.
Unset(ctx context.Context, dir, branch string, key Key) error
// All lists every known key on every branch, in the store's order.
All(ctx context.Context, dir string) ([]Entry, error)
}
A Backend stores the records. Every read treats an absent key as "" with no error, as `git config --get` exits 1 for it.
type DriveFinish ¶
type DriveFinish struct {
State string // FinishQueued or FinishRunning
Action string // "" for none
}
A DriveFinish is the Finish key's value.
func ParseDriveFinish ¶
func ParseDriveFinish(s string) (DriveFinish, bool)
ParseDriveFinish reads the Finish key's value; false for one that is empty or malformed.
func (DriveFinish) Format ¶
func (d DriveFinish) Format() string
Format is the value the Finish key holds: `queued`, `running: merging #204`.
func (DriveFinish) Running ¶
func (d DriveFinish) Running() bool
Running reports finish itself at work, not queued behind ship or a base.
type Key ¶
type Key string
A Key is one entry's name under the branch's section. The names are on disk in live checkouts, so they never change.
const ( // Task links the branch to its task: a branch picked up from a PR need // not carry the id in its name, and a bundle's branch links its lead. Task Key = "f10-task" // Riders lists a bundle's riders, space-separated: the tasks one branch // ships beside its lead. Riders Key = "f10-tasks" // After and AfterBranch are the base task and its branch `f10 start // --after` records. Finish swaps them for Landed so the next step brings // the default branch in first. After Key = "f10-after" AfterBranch Key = "f10-after-branch" Landed Key = "f10-landed" // Join lists, space-separated, the bases a join waited for: tasks that // merged before it branched from the default branch. Join Key = "f10-join" // Moved is drive's note that the base's head moved past the branch, for // the next catchup, which clears it and Landed. Moved Key = "f10-base-moved" // Tip is the base commit the branch was last built on: a catchup rebases // onto from it once the base's history is rewritten. Tip Key = "f10-base-tip" // Agent is the whole profile (kind:model:effort) a start or drive gave // the branch's agent, read back on a rerun; absent for the kind's default. Agent Key = "f10-agent" // Finish is a drive's record that it finishes the branch, and where // that finish stands. Whether the drive still runs is its task's lease, // never this: finish removes it with the branch, and a drive that stops // short sets it back to queued. Finish Key = "f10-finish" // Drive is the last skill drive saw the task finish: plan, ship or finish. Drive Key = "f10-drive" // Chain is the skills an older drive ran the task through, space-joined. // Drive no longer writes it, and removes one it finds. Chain Key = "f10-chain" // Flow and Pace are what a started task runs, for status and a rerun. Flow Key = "f10-flow" Pace Key = "f10-pace" // Watch is "false" once `f10 watch off` hands the task back. Watch Key = "f10-watch" // CI is what a triage of red checks tried during one red spell // (ci.go); any green read clears it. CI Key = "f10-ci" // Discuss marks a discussion's branch with the ids it opened for. A // start run there hands it on, and the drive's first prompt waits for // the discussion's turn to end, then clears it. Discuss Key = "f10-discuss" )
type Record ¶
type Record struct {
Branch string
Task string
Riders []string
After string
AfterBranch string
Landed string
Moved string
Tip string
Agent string
Finish *DriveFinish // nil when absent or malformed
Drive string
Flow string
Pace string
Watch string
CI Triage
Discuss []string
Join []string
}
A Record is every key one branch holds, "" or nil where absent.
type Triage ¶ added in v0.60.0
type Triage struct {
Tried []Tried
}
A Triage is the CI key's value: `<sha>:<action>` entries, space-joined. A fix counts for the branch, since it moves the head; a rerun counts for its sha, since the head stays.
func ParseTriage ¶ added in v0.60.0
ParseTriage reads the CI key's value, skipping malformed entries.
func ReadTriage ¶ added in v0.60.0
ReadTriage is branch's record; absent is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package branchmetatest answers branch records from memory, so a test sets and checks a record by branch and key instead of scripting git's argv.
|
Package branchmetatest answers branch records from memory, so a test sets and checks a record by branch and key instead of scripting git's argv. |