mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 10:32:10 +00:00
e061930706
The Kokoro build script sets up access to the chromium gerrit, creates the merge commit and uploads it. BUG=b:209034086 TEST=./ci/kokoro/simulate merge-to-chromeos.sh Change-Id: Ia686b937c3d6b0b744d5c2162eb2847c5952e977 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3318793 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dennis Kempin <denniskempin@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
73 lines
1.8 KiB
Bash
Executable file
73 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
# Copyright 2021 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
#
|
|
# Script to create a commit to merge cros/main into cros/chromeos with a useful
|
|
# commit message.
|
|
#
|
|
# Basic usage to upload a merge to gerrit:
|
|
#
|
|
# $ repo start uprev .
|
|
# $ ./tools/chromeos/create_merge
|
|
# $ git push cros HEAD:refs/for/chromeos
|
|
#
|
|
# To merge with a specific commit, use: ./tools/chromeos/create_merge $SHA
|
|
|
|
set -e
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/../../" || exit
|
|
|
|
LOCAL_BRANCH=$(git branch --show-current)
|
|
REMOTE_NAME=$(git config "branch.${LOCAL_BRANCH}.remote")
|
|
URL=$(git remote get-url "${REMOTE_NAME}")
|
|
|
|
DEFAULT_TARGET="${REMOTE_NAME}/main"
|
|
MERGE_TARGET="${1:-${DEFAULT_TARGET}}"
|
|
|
|
commit_list() {
|
|
git log --oneline --decorate=no --no-color "HEAD..${MERGE_TARGET}"
|
|
}
|
|
|
|
prerequisites() {
|
|
if [[ -e "${LOCAL_BRANCH}" ]] ||
|
|
[[ -e "${REMOTE_NAME}" ]] ||
|
|
[[ -e "${URL}" ]]; then
|
|
echo "This script requires the local repository to be on" \
|
|
"a tracking branch."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -n $(git status -s) ]]; then
|
|
echo "Working directory is not clean:"
|
|
git status -s
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "$(commit_list)" ]]; then
|
|
echo "Nothing to merge."
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
merge_message() {
|
|
local old=$(git rev-parse HEAD)
|
|
local new=$(git rev-parse "${MERGE_TARGET}")
|
|
local count=$(commit_list | wc -l)
|
|
|
|
echo "Merge ${count} commits from ${MERGE_TARGET} ($(date +%F))"
|
|
echo ""
|
|
commit_list
|
|
echo ""
|
|
echo "${URL}/+log/${old}..${new}"
|
|
echo ""
|
|
echo "BUG=None"
|
|
echo "TEST=CQ"
|
|
}
|
|
|
|
main() {
|
|
prerequisites
|
|
git merge --no-ff "${MERGE_TARGET}" -m "$(merge_message)"
|
|
git --no-pager log -n 1
|
|
}
|
|
|
|
main
|