Land changes
Undo a landing
Take one landed change back out of trunk with a new checked change, and keep trunk's history as it is.
bay is in development. These pages describe bay as it will ship.
bay undo reverses the effect of one landed change. It opens a new change that takes that landing's edits back out of current trunk. The new change runs the same checks and lands like any other change. Use it when a landing breaks something and a fix would take longer.
An undo never rewrites trunk. Every commit before it stays as it was. The undo lands as a new commit with a Reverts: trailer that names the undone change.
When to use undo
- A red after landing: a check that runs after landing fails, and one change caused it.
- A wrong landing: a change reached trunk that should not have.
- Bring a change back: undo the undo, and the original edits return.
Undo a change
Name the landed change. bay returns at once with queued, and an executor finishes the landing.
bay undo c7k2m4Wait for the outcome
--wait runs the work here and returns its outcome, as bay land --wait does. bay undo has no --observe.
bay undo c7k2m4 --waitRepair a conflict
Later changes may have edited the same lines. Then the undo does not merge, and bay returns MERGE_CONFLICT. bay leaves the undo change open. detail.view names its view, with conflict markers in the files. Resolve the paths in detail.conflicts, then land the undo from that view.
cd <detail.view>
# resolve each path in detail.conflicts
bay land --waitHow an undo works
- 01
Find the landing
bay asks the remote for the landed marker
refs/bay/landed/<change>. It then finds that landing commit on trunk. - 02
Build the reverse
bay merges the reverse of that commit onto current trunk with
git merge-tree. When the result equals trunk's own tree, the effect is already gone. bay opens no change. - 03
Open the undo change
bay opens a new change on the intent
undo of <change>. Its paths are the paths that the landing touched. bay writes the reverse into the view of that change. - 04
Land
The undo change takes the normal path to trunk, with the same required checks. Its landing commit carries
Reverts: <change>.
Undo the same change twice
- Each undo of one change claims the next generation of the intent
undo of <change>. - A second undo waits for the first one to land. Before that, bay refuses it with
CHANGE_SUPERSEDED. - The second undo also carries a
Supersedes:trailer that names the first undo. - An undo never claims a generation of the undone change's own intent.
Results
ok, landed and queued exit 0. blocked exits 10, and failed exits 20.
| Result | When | `detail` |
|---|---|---|
queued | Without --wait: the undo change is open and waits for an executor. | As for bay land. |
landed | With --wait: the undo landed. | As for bay land --wait. |
ok | The effect is already gone from trunk. bay opens no change, so the result has no change. | undo: "nothing to undo", reverts, trunk |
blocked, CHANGE_NOT_LANDED | The change is not on trunk. | trunk |
blocked, MERGE_CONFLICT | The reverse does not merge onto trunk. The view stays open for repair. | conflicts, view, reverts, trunk |
failed | bay cannot read the remote, so it cannot tell whether the change landed. | A string that says why. |
What an undo cannot do
- It cannot remove a commit from trunk. Trunk stays append-only.
- It cannot skip the checks. The undo is an ordinary change.
- It cannot undo a change that is not on trunk. Abandon that change instead.
- It undoes one change per call. Run it once for each change.
Refusals
Each refusal is blocked and exits 10. The Results page lists what to do next for each one.
| Code | Meaning |
|---|---|
CHANGE_NOT_LANDED | The named change is not on trunk. |
MERGE_CONFLICT | The reverse does not merge onto current trunk. detail.view holds it for repair. |
CHANGE_SUPERSEDED | An earlier undo of the same change has not landed yet. |