3 # Script for generating a list of candidates for cherry-picking to a stable branch
7 # $ bin/get-pick-list.sh
8 # $ bin/get-pick-list.sh > picklist
9 # $ bin/get-pick-list.sh | tee picklist
11 # The output is as follows:
12 # [nomination_type] commit_sha commit summary
14 is_stable_nomination
()
16 git show
--summary "$1" |
grep -q -i -o "CC:.*mesa-stable"
21 git show
--summary "$1" |
grep -q -i -o "CC:.*mesa-dev"
26 fixes
=`git show --pretty=medium -s $1 | tr -d "\n" | \
27 sed -e 's/fixes:[[:space:]]*/\nfixes:/Ig' | \
28 grep "fixes:" | sed -e 's/\(fixes:[a-zA-Z0-9]*\).*$/\1/'`
30 fixes_count
=`echo "$fixes" | wc -l`
31 if [ $fixes_count -eq 0 ] ; then
34 while [ $fixes_count -gt 0 ] ; do
35 # Treat only the current line
36 id
=`echo "$fixes" | tail -n $fixes_count | head -n 1 | cut -d : -f 2`
37 fixes_count
=$
(($fixes_count-1))
39 # Bail out if we cannot find suitable id.
40 # Any specific validation the $id is valid and not some junk, is
41 # implied with the follow up code
42 if [ "x$id" = x
] ; then
46 #Check if the offending commit is in branch.
48 # Be that cherry-picked ...
49 # ... or landed before the branchpoint.
50 if grep -q ^
$id already_picked ||
51 grep -q ^
$id already_landed
; then
58 # Use the last branchpoint as our limit for the search
59 latest_branchpoint
=`git merge-base origin/master HEAD`
61 # List all the commits between day 1 and the branch point...
62 git log
--reverse --pretty=%H
$latest_branchpoint > already_landed
64 # ... and the ones cherry-picked.
65 git log
--reverse --pretty=medium
--grep="cherry picked from commit" $latest_branchpoint..HEAD |\
66 grep "cherry picked from commit" |\
67 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
69 # Grep for potential candidates
70 git log
--reverse --pretty=%H
-i --grep='^CC:.*mesa-stable\|^CC:.*mesa-dev\|fixes:' $latest_branchpoint..origin
/master |\
73 # Check to see whether the patch is on the ignore list.
74 if [ -f bin
/.cherry-ignore
] ; then
75 if grep -q ^
$sha bin
/.cherry-ignore
; then
80 # Check to see if it has already been picked over.
81 if grep -q ^
$sha already_picked
; then
85 if is_stable_nomination
"$sha"; then
87 elif is_typod_nomination
"$sha"; then
89 elif is_fixes_nomination
"$sha"; then
95 printf "[ %8s ] " "$tag"
96 git
--no-pager show
--summary --oneline $sha