The Chromium Chronicle #22: Know Thy (Depot) Tools
Episode 22: by Edward Lesmes in San Francisco, CA (June, 2021)
Depot Tools is a collection of tools built on top of Git to simplify the workflow of developers contributing to the Chromium codebase and related projects. It contains tools to get the code, upload changes for review, keep your checkout up to date, and more!
Get the code
fetch chromium in an empty directory. The
fetch command can also be used to get the code for other repositories like v8, or webrtc. See
fetch help for a full list.
Upload a change for review
Each CL corresponds to a single branch in git, so start by running
git new-branch <branch_name> to create a new branch. Commit as many changes as you like to this branch and run
git cl upload when it's ready for review.
git cl issue will let you know what CL your branch is associated with. Use
git cl issue <issue> to change it.
Keep your checkout up to date
git rebase-update periodically to sync local branches to their upstream, and
gclient sync to update
third_party repos and run pre-compile hooks.
Manage multiple CLs
git cl statuswill show CLs associated with local branches and their status (unsent, lgtm, closed, etc).
git thawwork like
git stash, but keep track of the branch associated with the stashed changes.
git mapwill show you the history of all of your branches, and
git map-brancheswill show you the upstream relationships between all your branches.
git new-branch --upstream_current <branch_name>creates a new branch on top of an existing branch. Use
git rebase-updateto rebase a dependent branch after making changes to the base branch.
Keep working on an existing CL on a different machine
git cl patch <issue_url> to cherry-pick an existing CL on top of the current branch. Note that it will associate the current branch with the patched CL. Use
git cl patch <issue_url> --reapply to discard local changes and reapply the issue.