1# Branching Perfetto for Chrome milestones 2 3Merging a (set of) Perfetto change(s) to a Chrome milestone release requires 4creation of a branch in the perfetto repo, cherry-picking of the change(s) to 5the branch, and updating the `DEPS` file in Chrome's milestone branch to point 6to the new perfetto branch's head. 7 8## Creating the perfetto branch {#branch} 9 101. Determine the branch name: **`chromium/XXXX`**, where `XXXX` is the branch 11 number of the milestone (see 12 [Chromium Dash](https://chromiumdash.appspot.com/branches)). Example for 13 M87: `chromium/4280`. 14 151. Check if the branch already exists: if yes, skip to 16 [cherry-picking](#all-tables). To check, you can search for it in 17 [Gerrit's branch page](https://android-review.googlesource.com/admin/repos/platform/external/perfetto,branches). 18 191. Look up the appropriate base revision for the branch. You should use the 20 revision that Chromium's `DEPS` of the milestone branch points to (search 21 for `perfetto` in the file). The `DEPS` file for branch XXXX is at: 22 23 `https://chromium.googlesource.com/chromium/src.git/+/refs/branch-heads/XXXX/DEPS` 24 25 Example for M87: 26 [`DEPS`](https://chromium.googlesource.com/chromium/src.git/+/refs/branch-heads/4280/DEPS) 27 (at time of writing) points to `f4cf78e052c9427d8b6c49faf39ddf2a2e236069`. 28 291. Create the branch - the easiest way to do this is via 30 [Gerrit's branch page](https://android-review.googlesource.com/admin/repos/platform/external/perfetto,branches). 31 The `NEW BRANCH` button on the top right opens a wizard - fill in the branch 32 name and base revision determined above. If this fails with a permission 33 issue, contact the [Discord chat](https://discord.gg/35ShE3A) or 34 [perfetto-dev](https://groups.google.com/forum/#!forum/perfetto-dev) mailing 35 list. 36 37## Cherry-picking the change(s) {#cherry-pick} 38 391. If there are no merge conflicts, cherry-picking via Gerrit will be easiest. 40 To attempt this, open your change in Gerrit and use the `Cherry pick` entry 41 in the overflow menu on the top right, providing the `chromium/XXXX` branch 42 name (see [above](#branch)). 43 441. Otherwise, merge the patch locally into a branch tracking 45 `origin/chromium/XXXX` and upload a Gerrit change as usual: 46 47 ``` 48 $ git fetch origin 49 $ git checkout -tb cpick origin/chromium/XXXX 50 $ git cherry-pick -x <commit hash> # Resolve conflicts manually. 51 $ tools/gen_all out/xxx # If necessary. 52 $ git cl upload # Remove "Change-Id:" lines from commit message. 53 ``` 54 551. Send the patch for review and land it. Note the commit's revision hash. 56 57## Updating the DEPS file in Chromium 58 591. Create, send for review, and land a Chromium patch that edits the top-level 60 `DEPS` file on the Chromium's milestone branch. You can also combine this 61 step with cherry-picks of any chromium changes. For details, see 62 [Chromium's docs](https://www.chromium.org/developers/how-tos/drover). It 63 amounts to: 64 65 ``` 66 $ gclient sync --with_branch_heads 67 $ git fetch 68 $ git checkout -tb perfetto_uprev refs/remotes/branch-heads/XXXX 69 $ ... # Edit DEPS. 70 $ git cl upload 71 ``` 72