Documentation
¶
Overview ¶
Package merge plans how orb upgrade and orb add carry template changes into an app the developer has edited: a 3-way merge per file between what orb wrote before (base), what it writes now (theirs) and the file on disk (ours). Developer edits are never dropped: overlapping changes become conflict markers (ADR-0016, ADR-0050).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
An Action is what happens to one file.
const ( // Unchanged: nothing to write; the file already holds the result. Unchanged Action = "unchanged" // Update: the developer never edited the file; it takes the new template. Update Action = "update" // Create: a new template file. Create Action = "create" // Delete: a template file removed in the new release, never edited. Delete Action = "delete" // Merged: both sides changed different lines; merged cleanly. Merged Action = "merged" // Conflict: both sides changed the same lines; Content holds markers. Conflict Action = "conflict" // Kept: the new release removed or changed a file the developer deleted // or edited in a way that can't be applied; left as it is, with a Note. Kept Action = "kept" )
Actions, from nothing to do to needing the developer.
type Change ¶
type Change struct {
Path string `json:"path"`
Action Action `json:"action"`
// Content is what to write for Update, Create, Merged and Conflict.
Content []byte `json:"-"`
// Note explains a Kept file or an unproven base.
Note string `json:"note,omitempty"`
}
A Change is the planned result for one file.
type Input ¶
type Input struct {
// Base is what orb wrote at the old release, by path.
Base map[string][]byte
// Theirs is what orb writes at the new release, by path.
Theirs map[string][]byte
// Unproven lists base files whose rebuilt content didn't match the hash
// orb recorded, so they can't be trusted to tell edits from templates.
Unproven map[string]bool
// Ours reads the file at path from the app; ok is false when it doesn't
// exist.
Ours func(path string) (content []byte, ok bool, err error)
// Label names the new release in conflict markers, such as
// "gorbital v0.1.0".
Label string
}
Input is what Plan merges.
Click to show internal directories.
Click to hide internal directories.