mb/google/poppy/variants/nocturne: remove dup'ed dptf_enable
[coreboot.git] / util / scripts / cross-repo-cherrypick
blob38d4f46fe761c592f0804ef12ec1947e16dd1eef
1 #!/bin/sh
3 # rebase.sh - rebase helper script
5 # Copyright 2015, 2017 Google Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; version 2 of the License.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
17 # Adapt to your remote branch:
18 BRANCH="origin/master"
20 # When pulling in patches from another tree from a gerrit repository,
21 # do the following at the end of a larger cherry-pick series:
22 # git remote add ...
23 # git checkout -b upstreaming
24 # git cherry-pick ...
25 # git rebase -i --exec util/gitconfig/rebase.sh master
26 # Alternatively, you can run util/gitconfig/rebase.sh after every
27 # individual cherry-pick.
29 # use $0 --cros to add a stub BUG/BRANCH/TEST block
31 commit_message() {
32 git log -n 1 | grep "^ " | cut -c5-
35 ORIGIN_HOST=$( commit_message |grep "^Reviewed-on: " |head -1 |cut -d/ -f3 )
36 case "${ORIGIN_HOST}" in
37 review.coreboot.org)
38 BRANCH="origin/master"
39 MESSAGE_PREFIX="UPSTREAM: "
41 chromium-review.googlesource.com)
42 BRANCH="cros/chromeos-2016.05"
43 MESSAGE_PREFIX=""
45 esac
47 # lines must be backwards due to tac(1)
48 SPLICE_CMD=""
49 if test "$1" = "--cros"; then
50 if test -z "$( commit_message |egrep '^(BUG|TEST)=')"; then
51 SPLICE_CMD='print "\nTEST=none\nBRANCH=none\nBUG=none\n"'
55 CHID=$( commit_message | grep -i "^Change-Id: I" )
56 CID=$( git log -n1 --grep "^$CHID$" --pretty=%H $BRANCH )
57 GUID="$(git config user.name) <$(git config user.email)>"
59 # TBD: Don't add Original- to empty lines, and possibly make script more
60 # solid for commits with an unexpected order of meta data lines.
62 (printf "${MESSAGE_PREFIX}"; commit_message) | tac | awk '/^$/ {
63 if (end==0) {
64 print "Original-Commit-Id: '"${CID}"'\nSigned-off-by: '"${GUID}"'";
65 '"${SPLICE_CMD}"'
67 end=1
68 }; /^(BUG|BRANCH|TEST|CQ-DEPEND)=/ {
69 if (end==0) {
70 print "Original-Commit-Id: '"${CID}"'\nSigned-off-by: '"${GUID}"'";
71 print "";
73 end=1
74 }; {
75 if (end==0)
76 print "Original-" $0;
77 else
78 print $0;
79 }' | tac | git commit --amend -F -