1 #!/bin/sh 2 3 # Script for generating a list of candidates which fix commits that have been 4 # previously cherry-picked to a stable branch. 5 # 6 # Usage examples: 7 # 8 # $ bin/get-extra-pick-list.sh 9 # $ bin/get-extra-pick-list.sh > picklist 10 # $ bin/get-extra-pick-list.sh | tee picklist 11 12 # Use the last branchpoint as our limit for the search 13 latest_branchpoint=`git merge-base origin/master HEAD` 14 15 # Grep for commits with "cherry picked from commit" in the commit message. 16 git log --reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD |\ 17 grep "cherry picked from commit" |\ 18 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked 19 20 # For each cherry-picked commit... 21 cat already_picked | cut -c -8 |\ 22 while read sha 23 do 24 # ... check if it's referenced (fixed by another) patch 25 git log -n1 --pretty=oneline --grep=$sha $latest_branchpoint..origin/master |\ 26 cut -c -8 |\ 27 while read candidate 28 do 29 # And flag up if it hasn't landed in branch yet. 30 if grep -q ^$candidate already_picked ; then 31 continue 32 fi 33 echo Commit $candidate references $sha 34 done 35 done 36 37 rm -f already_picked 38