fx revertfx revert is a host tool that orchestrates pure reverts of submitted Gerrit changes across Fuchsia repositories (e.g. fuchsia.git and vendor/google).
It generates authentic Gerrit server-side reverts via Gerrit's REST API, ensuring that Rubber Stamper (rubber-stamper@appspot.gserviceaccount.com) automatically recognizes the reverts and approves them with Bot-Commit +1 / Code-Review +2.
/revert REST endpoint. The change must be MERGED; its Depends-on footers are reported but related changes are not reverted automatically.Fuchsia-Auto-Submit +1 for hands-off tree unblocking.Reason for revert:, Failure Link:, and Bug: references.//tools/revert:install is part of the //tools group. If your build does not include it, add it explicitly:
fx set ... --with-host //tools/revert:install
To build only the tool and its unit tests:
fx build --host //tools/revert:install //tools/revert:tests
fx revert operates entirely through Gerrit's REST API (gob-curl or plain curl). It does not read or modify any local Git repository:
origin/main. A checkout that lags behind origin has no effect on the result, because the change metadata and the revert itself come directly from Gerrit.HEAD, or local commits, and never touches any of them.gob-curl when it is installed. Otherwise fx revert prints a warning and falls back to plain curl with ~/.netrc and ~/.gitcookies; requests to internal hosts or authenticated endpoints may fail without valid cookies.Always preview the revert plan before executing. Running without --upload only prints the plan (dry-run mode is the default):
fx revert <gerrit_url> --dry-run
Example:
fx revert https://fuchsia-review.googlesource.com/c/fuchsia/+/1783117 \ -m "Reverting suspect CL due to builder failure of core.arm64-debug" \ -f "go/bbid/8672361213915190673" \ -b "12345" \ --dry-run
Upload the revert to Gerrit with Rubber Stamper reviewer:
fx revert <gerrit_url> \ -m "<reason>" \ -f "<failure_link>" \ -b "<bug_id>" \ --upload
The full plan summary is always printed before any Gerrit API calls are made.
To automatically set Fuchsia-Auto-Submit +1 on the created revert CL:
fx revert <gerrit_url> \ -m "Reverting broken build" \ -f "go/bbid/..." \ --upload \ --auto-submit
<gerrit_url>: Positional (Required). Full Gerrit URL to the change (e.g. https://fuchsia-review.googlesource.com/c/fuchsia/+/123456).-m, --reason: Custom reason for the revert in the commit message.-f, --failure-link: Link to builder failure, log, or test failure (e.g. go/bbid/... or https://ci.chromium.org/...).-b, --bug: Associated Buganizer issue tracker ID (e.g. 12345 or b/12345).--upload: Create and upload the revert CL via Gerrit REST API with Rubber Stamper reviewer. Without this flag, the tool runs in dry-run mode.--dry-run: Preview the planned revert without executing API calls.--auto-submit: Apply Fuchsia-Auto-Submit +1 vote to the created revert CL (default: off).-h, --help: Display usage and help information.Run unit tests via fx test:
fx test //tools/revert:tests --host