mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: util/scripts: extend cross-repo-cherrypick
The script now automatically discovers the original branch (if known)
and configures itself appropriately.
Additionally, commit messages for changes coming _from_ upstream will
be prefixed with "UPSTREAM: ".
With the optional --cros argument, it also adds a BUG/BRANCH/TEST block
at the right place in the commit message (right above the metadata) if
one doesn't already exist.
BUG=none
BRANCH=none
TEST=none
Change-Id: I7ad3fb5317d9e3090f43ea983fcfb2ab099c43a4
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 6f27edd377
Original-Change-Id: I81864ddca62fd99a9eb905d7075e5b53f58c4eb5
Original-Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/18135
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://chromium-review.googlesource.com/430179
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
This commit is contained in:
parent
7769432278
commit
3c1f742a08
1 changed files with 29 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
# rebase.sh - rebase helper script
|
||||
#
|
||||
# Copyright 2015 Google Inc.
|
||||
# Copyright 2015, 2017 Google Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -15,7 +15,7 @@
|
|||
#
|
||||
|
||||
# Adapt to your remote branch:
|
||||
BRANCH="cros/chromeos-2016.05"
|
||||
BRANCH="origin/master"
|
||||
|
||||
# When pulling in patches from another tree from a gerrit repository,
|
||||
# do the following at the end of a larger cherry-pick series:
|
||||
|
@ -26,10 +26,32 @@ BRANCH="cros/chromeos-2016.05"
|
|||
# Alternatively, you can run util/gitconfig/rebase.sh after every
|
||||
# individual cherry-pick.
|
||||
|
||||
# use $0 --cros to add a stub BUG/BRANCH/TEST block
|
||||
|
||||
commit_message() {
|
||||
git log -n 1 | grep "^ " | cut -c5-
|
||||
}
|
||||
|
||||
ORIGIN_HOST=$( commit_message |grep "^Reviewed-on: " |head -1 |cut -d/ -f3 )
|
||||
case "${ORIGIN_HOST}" in
|
||||
review.coreboot.org)
|
||||
BRANCH="origin/master"
|
||||
MESSAGE_PREFIX="UPSTREAM: "
|
||||
;;
|
||||
chromium-review.googlesource.com)
|
||||
BRANCH="cros/chromeos-2016.05"
|
||||
MESSAGE_PREFIX=""
|
||||
;;
|
||||
esac
|
||||
|
||||
# lines must be backwards due to tac(1)
|
||||
SPLICE_CMD=""
|
||||
if test "$1" = "--cros"; then
|
||||
if test -z "$( commit_message |egrep '^(BUG|TEST)=')"; then
|
||||
SPLICE_CMD='print "\nTEST=none\nBRANCH=none\nBUG=none\n"'
|
||||
fi
|
||||
fi
|
||||
|
||||
CHID=$( commit_message | grep -i "^Change-Id: I" )
|
||||
CID=$( git log -n1 --grep "^$CHID$" --pretty=%H $BRANCH )
|
||||
GUID="$(git config user.name) <$(git config user.email)>"
|
||||
|
@ -37,9 +59,11 @@ GUID="$(git config user.name) <$(git config user.email)>"
|
|||
# TBD: Don't add Original- to empty lines, and possibly make script more
|
||||
# solid for commits with an unexpected order of meta data lines.
|
||||
|
||||
commit_message | tac | awk '/^$/ {
|
||||
if (end==0)
|
||||
print "Original-Commit-Id: '"$CID"'\nSigned-off-by: '"$GUID"'";
|
||||
(printf "${MESSAGE_PREFIX}"; commit_message) | tac | awk '/^$/ {
|
||||
if (end==0) {
|
||||
print "Original-Commit-Id: '"${CID}"'\nSigned-off-by: '"${GUID}"'";
|
||||
'"${SPLICE_CMD}"'
|
||||
}
|
||||
end=1
|
||||
}; {
|
||||
if (end==0)
|
||||
|
|
Loading…
Add table
Reference in a new issue