crosvm: Script for rebasing on main from chromeos branch.

chromeos branch is a stable base to work on, but patches need to land on
the main branch. For uploading to that directory, it's always necessary
to rebase onto that branch.

BUG=b:227535695
TEST=rebase_for_review && repo upload --cbr .

Change-Id: I5f41e52f91adf15ade84ae09f6b34dcdbe733d23
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3565627
Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
Junichi Uekawa 2022-04-01 19:20:24 +09:00 committed by Chromeos LUCI
parent a5d52312d5
commit 3cb328aa10
2 changed files with 25 additions and 1 deletions

View file

@ -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

View file

@ -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