diff --git a/docs/book/src/integration/chromeos.md b/docs/book/src/integration/chromeos.md index 2339349423..5f99ee2812 100644 --- a/docs/book/src/integration/chromeos.md +++ b/docs/book/src/integration/chromeos.md @@ -29,13 +29,16 @@ However, changes are not acceped to the `cros/chromeos` branch, and should be su `cros/main` instead. Use `repo upload -D main` to upload changes to the main branch, which works fine in most cases where -gerrit can rebase the commit cleanly. If not, please rebase to `cros/main` manually: +gerrit and kokoro can rebase the commit cleanly. If not, please rebase to `cros/main` manually: ```bash git branch --set-upstream-to cros/main git rebase ``` +If this doesn't work, use `tools/chromeos/rebase_for_review` to rebase the changes onto main and +`repo upload` to upload changes to the main branch. + ## First time setup / running tools - All CrosVM `tools` are not expected to work inside the ChromeOS chroot. As such, they must be run diff --git a/tools/chromeos/rebase_for_review b/tools/chromeos/rebase_for_review new file mode 100755 index 0000000000..a304563d82 --- /dev/null +++ b/tools/chromeos/rebase_for_review @@ -0,0 +1,21 @@ +#!/bin/bash +# Copyright 2022 The ChromiumOS Authors. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +set -e + +function main() { + local review_branch="tmp-$(date +%Y%m%d)-$RANDOM" + git checkout -b "${review_branch}" + git branch --set-upstream-to cros/main + git fetch cros main + git rebase --onto cros/main cros/chromeos "${review_branch}" || true + echo " + +Review branch ${review_branch} created! + +Resolve any conflicts and do review with repo upload. +git checkout - to go back to the previous branch." +} + +main