Page kind: Reference
swarmops revert#
Take back a changeset, or a range of a ref's history, by landing its inverse.
The land commits, on REV, every path the range (SINCE, REV] touched set to what SINCE held there, and lands that change from REV onto the ref: what the ref gained since stays, and a later change to the same lines is E_CONFLICT (exit 3), naming the changeset that made it, with nothing recorded. The landed changeset records the range as reverts and the reason as revert_reason; show prints both. Merges in the range are taken back against their first parents.
- Group
write- Since
0.11.0- Mutates
- yes
- Identity required
- yes
- MCP tool
revert- Envelope op
revert- Exit codes
- 023
- Errors
- E_INVALID_ARGE_CONFLICT
Syntax#
swarmops revert [OPTIONS] --reason <TEXT> <REV>Required arguments#
Syntax: <REV>.
The changeset to take back, the range's last: on the ref's first-parent chain.
Syntax: --reason <TEXT>.
Why, 1 to 4,096 bytes: recorded, and the default message's body.
Optional arguments#
The command also takes the global options.
Syntax: --since <REV>.
Take back the range after this first-parent ancestor of REV, at most 256 changesets (default: REV alone).
Syntax: --onto <REF>.
Default: main.
The ref to land the revert on: main or a release ref (release/NAME).
Syntax: --key <KEY>.
Makes a retry of this land safe: 1 to 64 letters, digits and '-', such as a uuid v7. Make a new one for each change you land, and give it again only to retry that land.
A land with a key first looks down the ref's first parents, to the change's base, for a changeset landed with the same key: one squashed from this HEAD is the land made before, which the land replays (status: replayed) without writing anything; one from another head is E_INVALID_ARG. A key not found there is looked for on the other main, release and branch refs: one that landed on another target is E_INVALID_ARG too, and details.target names the ref. Without a key, the same land run again finds its change on the ref already: E_NOTHING_TO_LAND.
Syntax: -m, --message <MSG>.
The landed changeset's message (default: "Revert", 12 hex digits of REV and its title, then the reason).
Syntax: --expect-target <ID>.
Publish only while the ref names this changeset, a full id: one attempt, and a ref that moved is E_CAS_MISMATCH with nothing written.
Examples#
swarmops --repo [tmp]/store --as agent/worker-17 revert [a] --reason 'a broke the build' --key revert-1Show 24 more lines
"land":Exit code 0. Recorded by the CLI tests. A name in square brackets, such as [tmp] or [c1], stands for what differs from run to run: the test's temporary directory, an id, a time.
No recorded example yet.
Return information#
result is a RevertResp (swarmops schema RevertResp prints its JSON Schema).
| Field | Type | Required | Description |
|---|---|---|---|
land | LandResp | yes | The land: squashed_from holds the one changeset it committed, the inverse change. |
reverted | array of string | yes | The changesets taken back, oldest first, as the landed changeset's reverts records them. |
Envelope op: revert.
Exit codes:
0: Success.2: The request or the command line is malformed.3: The change conflicts with what it lands on: resolve it, then run the operation again.
Errors#
- E_INVALID_ARG (exit 2): A malformed argument or request, including a command-line usage error.
- E_CONFLICT (exit 3): The change conflicts with the target:
details.reportlists each conflicting file with its kind, its hunks and who changed it on the target.
Any command that opens a store may also fail with a store error, such as E_NOT_A_REPO, E_IO or E_STORE_CORRUPT; a command line the grammar refuses is E_INVALID_ARG (exit 2).