3 # Script for generating a list of candidates [referenced by a Fixes tag] for
4 # cherry-picking to a stable branch
8 # $ bin/get-fixes-pick-list.sh
9 # $ bin/get-fixes-pick-list.sh > picklist
10 # $ bin/get-fixes-pick-list.sh | tee picklist
12 # Use the last branchpoint as our limit for the search
13 latest_branchpoint
=`git merge-base origin/master HEAD`
15 # List all the commits between day 1 and the branch point...
16 git log
--reverse --pretty=%H
$latest_branchpoint > already_landed
18 # ... and the ones cherry-picked.
19 git log
--reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD |\
20 grep "cherry picked from commit" |\
21 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
23 # Grep for commits with Fixes tag
24 git log
--reverse --pretty=%H
-i --grep="fixes:" $latest_branchpoint..origin
/master |\
27 # Check to see whether the patch is on the ignore list ...
28 if [ -f bin
/.cherry-ignore
] ; then
29 if grep -q ^
$sha bin
/.cherry-ignore
; then
34 # For each one try to extract the tag
35 fixes_count
=`git show $sha | grep -i "fixes:" | wc -l`
36 if [ "x$fixes_count" != x1
] ; then
37 printf "WARNING: Commit \"%s\" has more than one Fixes tag\n" \
38 "`git log -n1 --pretty=oneline $sha`"
40 fixes
=`git show $sha | grep -i "fixes:" | head -n 1`
41 # The following sed/cut combination is borrowed from GregKH
42 id
=`echo ${fixes} | sed -e 's/^[ \t]*//' | cut -f 2 -d ':' | sed -e 's/^[ \t]*//' | cut -f 1 -d ' '`
44 # Bail out if we cannot find suitable id.
45 # Any specific validation the $id is valid and not some junk, is
46 # implied with the follow up code
47 if [ "x$id" = x
] ; then
51 # Check if the offending commit is in branch.
53 # Be that cherry-picked ...
54 # ... or landed before the branchpoint.
55 if grep -q ^
$id already_picked ||
56 grep -q ^
$id already_landed
; then
58 # Finally nominate the fix if it hasn't landed yet.
59 if grep -q ^
$sha already_picked
; then
63 printf "Commit \"%s\" fixes %s\n" \
64 "`git log -n1 --pretty=oneline $sha`" \