blob: a9d25b97e6bac9c7094f45b907342e6dbfd3fd16 [file] [log] [blame]
Emil Velikovc212a702015-09-02 17:36:22 +01001#!/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
14latest_branchpoint=`git branch | grep \* | cut -c 3-`-branchpoint
15
16# Grep for commits with "cherry picked from commit" in the commit message.
17git 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 |\
21while read sha
22do
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
35done