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
--pretty=medium
--summary "$1" |
grep -q -i -o "CC:.*mesa-stable"
21 git show
--pretty=medium
--summary "$1" |
grep -q -i -o "CC:.*mesa-dev"
26 # Helper to handle various mistypos of the fixes tag.
27 # The tag string itself is passed as argument and normalised within.
29 # Resulting string in the global variable "fixes" and contains entries
30 # in the form "fixes:$sha"
33 fixes
=`git show --pretty=medium -s $1 | tr -d "\n" | \
34 sed -e 's/'"$2"'/\nfixes:/Ig' | \
35 grep -Eo 'fixes:[a-f0-9]{4,40}'`
37 fixes_count
=`echo "$fixes" | grep "fixes:" | wc -l`
38 if test $fixes_count -eq 0; then
42 # Throw a warning for each invalid sha
43 while test $fixes_count -gt 0; do
44 # Treat only the current line
45 id
=`echo "$fixes" | tail -n $fixes_count | head -n 1 | cut -d : -f 2`
46 fixes_count
=$
(($fixes_count-1))
47 if ! git show
$id >/dev
/null
2>&1; then
48 echo WARNING
: Commit
$1 lists invalid sha
$id
55 # Checks if at least one of offending commits, listed in the global
56 # "fixes", is in branch.
59 fixes_count
=`echo "$fixes" | grep "fixes:" | wc -l`
60 while test $fixes_count -gt 0; do
61 # Treat only the current line
62 id
=`echo "$fixes" | tail -n $fixes_count | head -n 1 | cut -d : -f 2`
63 fixes_count
=$
(($fixes_count-1))
65 # Be that cherry-picked ...
66 # ... or landed before the branchpoint.
67 if grep -q ^
$id already_picked ||
68 grep -q ^
$id already_landed
; then
77 is_sha_nomination
"$1" "fixes:[[:space:]]*"
78 if test $?
-eq 0; then
81 is_sha_nomination
"$1" "fixes[[:space:]]\+"
84 is_brokenby_nomination
()
86 is_sha_nomination
"$1" "broken by"
89 is_revert_nomination
()
91 is_sha_nomination
"$1" "This reverts commit "
94 # Use the last branchpoint as our limit for the search
95 latest_branchpoint
=`git merge-base origin/master HEAD`
97 # List all the commits between day 1 and the branch point...
98 git log
--reverse --pretty=%H
$latest_branchpoint > already_landed
100 # ... and the ones cherry-picked.
101 git log
--reverse --pretty=medium
--grep="cherry picked from commit" $latest_branchpoint..HEAD |\
102 grep "cherry picked from commit" |\
103 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
105 # Grep for potential candidates
106 git log
--reverse --pretty=%H
-i --grep='^CC:.*mesa-stable\|^CC:.*mesa-dev\|\<fixes\>\|\<broken by\>\|This reverts commit' $latest_branchpoint..origin
/master |\
109 # Check to see whether the patch is on the ignore list.
110 if test -f bin
/.cherry-ignore
; then
111 if grep -q ^
$sha bin
/.cherry-ignore
; then
116 # Check to see if it has already been picked over.
117 if grep -q ^
$sha already_picked
; then
121 if is_fixes_nomination
"$sha"; then
123 elif is_brokenby_nomination
"$sha"; then
125 elif is_revert_nomination
"$sha"; then
127 elif is_stable_nomination
"$sha"; then
129 elif is_typod_nomination
"$sha"; then
136 fixes | brokenby | revert
)
137 if ! sha_in_range
; then
145 printf "[ %8s ] " "$tag"
146 git
--no-pager show
--no-patch --pretty=oneline
$sha