Emil Velikov | c212a70 | 2015-09-02 17:36:22 +0100 | [diff] [blame] | 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 |
Emil Velikov | a57d1af | 2017-02-13 00:13:55 +0000 | [diff] [blame^] | 13 | latest_branchpoint=`git merge-base origin/master HEAD` |
Emil Velikov | c212a70 | 2015-09-02 17:36:22 +0100 | [diff] [blame] | 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/)//' |\ |
| 19 | cut -c -8 |\ |
| 20 | while read sha |
| 21 | do |
| 22 | # Check if the original commit is referenced in master |
| 23 | git log -n1 --pretty=oneline --grep=$sha $latest_branchpoint..origin/master |\ |
| 24 | cut -c -8 |\ |
| 25 | while read candidate |
| 26 | do |
| 27 | # Check if the potential fix, hasn't landed in branch yet. |
| 28 | found=`git log -n1 --pretty=oneline --reverse --grep=$candidate $latest_branchpoint..HEAD |wc -l` |
| 29 | if test $found = 0 |
| 30 | then |
| 31 | echo Commit $candidate might need to be picked, as it references $sha |
| 32 | fi |
| 33 | done |
| 34 | done |