cub unit revert
cub unit revert
Take back a change to a unit, keeping what came after it
Synopsis
Take back a change to a unit with a new revision, keeping the changes made since.
What to revert is one change, or a range of revisions:
7 revision 7
ChangeSet:
Each end is a revision as --restore takes one: a number, HeadRevisionNum,
LastReleasedRevisionNum, Tag:
A range whose ends resolve the wrong way round on a unit, such as two tags named in the wrong order, is refused rather than re-applied.
A revert writes one new revision that takes back what the reverted revisions changed, and keeps everything done since, as git revert does. It is a merge of the unit with its own history with the range reversed ("cub unit update --merge-source Self --squash"), so a path changed again since keeps the later value only where the two do not touch. To go back to an earlier revision outright, dropping everything after it, restore it instead ("cub unit update --restore").
A revert is cleared for Override guards, since it takes back the unit's own change. A path held by any other guard is left as it is and reported as a conflict, with the --clearance that would take it.
A change order is undone with "cub variant demote", which restores each space it reached and records that it did.
Without --change-desc, the new revision is described by what it reverted, as "Reverted revisions 6-7", or for a changeset by the changeset and its description.
Examples:
# Revert the latest change
cub unit revert --space web-dev backend HeadRevisionNum
# Revert revision 7, showing what it would change first
cub unit revert --space web-dev backend 7 --dry-run -o mutations
# Revert revisions 6 and 7
cub unit revert --space web-dev backend 5..7
# Revert a changeset's changes to this unit
cub unit revert --space web-dev backend ChangeSet:web-dev/tls-rollout
cub unit revert <unit> <revisions> [flags]
Options
--change-desc string change description recorded on the new revisions; by default, what they reverted
--changeset string open changeset to record the new revisions in
--clearance stringArray class of guarded reason this change is cleared for, as KEY, KEY=VALUE[;VALUE...], KEY!=VALUE[;VALUE...], or !KEY to refuse any path carrying KEY (repeatable). A guarded path this does not cover is not written, and the withheld change is reported as a conflict. A revert is cleared for Override guards without it, since it takes back the unit's own change
--dry-run report what the command would write, and write nothing
--fail-on-timeout exit with status 4 rather than 0 when the wait for Triggers runs out before they finish, or cannot read a unit to tell. The changes are saved either way, so do not make them again
-h, --help help for revert
-o, --output string Output format. One of: json, yaml, name, wide, mutations, jq=<expr>, yq=<expr>, custom-columns=<spec>
--quiet No default output.
--timeout duration how long to wait for the Triggers of the units the command writes, as a duration such as 30s or 2m. The changes are saved whether or not the Triggers finish in time; when they do not, the command names the units and exits 0, unless --fail-on-timeout (default 2m0s)
--verbose Detailed output, additive with default output
--wait wait for the Triggers of the units the command writes to finish (default true)
Options inherited from parent commands
--component string the Component of --variant, when that names the variant alone; --variant <component>/<variant> says the same in one flag
--context string The context to use for this command
--debug Debug output
--space string space to operate in, by slug or UUID. Omitted, a list or bulk operation spans the organization and a single entity is named as <space>/<slug>; "*" means the same as omitting it
--variant string variant to operate in, as <component>/<variant>, or as <variant> with --component: the space naming that Component whose Variant label is <variant>. The same scope as --space, named by what it is rather than by the space's slug; the two cannot be combined
SEE ALSO
- cub unit - Unit commands