Files
brave-core/tools/cr
cdesouza-chromium a651e03a79 [plaster] Introducing a 🩹 YAML frontend (#36651)
This PR introduces the YAML frontend for plaster that is meant to
eventually become the only frontend, once all `.toml` Plaster files are
migrated.

This change covers all places where the assumption about `.toml` files
was being used, inclusing `brockit`, and `git-cr` tools.

Most of the code that should be deleted in the future is well guarded
with comments leading back to the issue tracking, so the TOML parser can
be dropped eventually.

With this change, a dependency to `pyyaml` has been introduced. This
dependency has wheels provided by `vpython`, which is already the
expected python runtime for Plaster.

 - Rationale for this change

We have experimented at length with `.toml` files, in order to
understand some of the shortcomings they have that would be addressed
with `.yaml` files.

 * `prettier` offers YAML formatting out-of-the-box. On the other hand,
   formatters for TOML files are not easy to find, as both `prettier`
   and `vpython` have their own challanges with the current options
 * YAML's sytanx works better with codeblocks, as it doesn't require
   quoting. This makes the content seen less noisy. Looking on some of
   the migrated plasters, the YAML substitutions look more readable.
 * YAML has better sytanx highlight support in some editors.

Bug: https://github.com/brave/brave-browser/issues/55738
2026-05-22 15:20:51 +01:00
..

tools/cr

Python tooling maintained by the Chromium Rebase team to support upgrading brave-core to new Chromium versions and to manage the patches and shadow files that live on top of upstream.

All scripts here are intended to run via vpython3; the .vpython3 spec in this directory pulls in rich, requests, and the other wheels they need. Most scripts accept --verbose to switch logging to DEBUG.

Important

Before adding or editing Python in this directory, read Python dos and donts.

Entry points

These are the user-facing scripts in this directory:

  • 🚀Brockit — End-to-end rebase orchestration. Updates the Chromium version, regenerates patches and strings, and walks the rebase forward.
  • 🩹Plaster — Applies and regenerates "plaster" files: semantic patches against upstream Chromium sources.
  • post_presubmit.py — Posts and refreshes GitHub PR comments from a npm run presubmit JSON dump.
  • find_rebase_commits.py — Resolves a Chromium rebase tag (e.g. cr148) to an oldest..newest git commit range.
  • prune_test_filters.py — Detects and (optionally) removes obsolete entries from the current platform's test-filter files.

Library modules

Shared abstractions used by the entry points and tests:

  • repository.pyRepository instances (repository.brave, repository.chromium) for paths and for running git commands at any repo.
  • terminal.py — Rich console, baseline logging config, and subprocess utilities.
  • vpython_utils.py — Provides vpython3 path.
  • patchfile.py — Patch file abstraction handling patches that failed to apply.
  • git_status.py — Parser for git status --porcelain output.
  • versioning.py — Chromium version number parsing.
  • vscode.py — IPC for opening files in VS Code in the integrated terminal.

Subdirectories

  • alias/git cr git-alias subcommands (commit, mv, follow-renames, ...). See alias/README.md.
  • test/ — Shared test fixtures, including FakeChromiumRepo.
  • toolchain/ — Scripts to build platform-specific toolchains when rebasing Chromium.

Tests

Every module of interest ships a *_test.py next to it. Tests should always have a vpython3 shebang line, and +x mode, so they can be run as their own utilities from the repo root.

Tests should keep mock use to a minimum. Make sure to always use FakeChromiumRepo to provide a test enviroment. Scripts tested with FakeChromiumRepo should rely always on relative paths derived from Repository.brave.root to permit tests to be run in integration with the repository sandbox provided with FakeChromiumRepo.