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 |
| 13 | # XXX: there should be a better way for this |
| 14 | latest_branchpoint=`git branch | grep \* | cut -c 3-`-branchpoint |
| 15 | |
| 16 | # Grep for commits with "cherry picked from commit" in the commit message. |
| 17 | git log --reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD |\ |
| 18 | grep "cherry picked from commit" |\ |
| 19 | sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' |\ |
| 20 | cut -c -8 |\ |
| 21 | while read sha |
| 22 | do |
| 23 | # Check if the original commit is referenced in master |
| 24 | git log -n1 --pretty=oneline --grep=$sha $latest_branchpoint..origin/master |\ |
| 25 | cut -c -8 |\ |
| 26 | while read candidate |
| 27 | do |
| 28 | # Check if the potential fix, hasn't landed in branch yet. |
| 29 | found=`git log -n1 --pretty=oneline --reverse --grep=$candidate $latest_branchpoint..HEAD |wc -l` |
| 30 | if test $found = 0 |
| 31 | then |
| 32 | echo Commit $candidate might need to be picked, as it references $sha |
| 33 | fi |
| 34 | done |
| 35 | done |