bin/get-pick-list.sh: prefix output with "[stable] "
[mesa.git] / bin / get-pick-list.sh
1 #!/bin/sh
2
3 # Script for generating a list of candidates for cherry-picking to a stable branch
4 #
5 # Usage examples:
6 #
7 # $ bin/get-pick-list.sh
8 # $ bin/get-pick-list.sh > picklist
9 # $ bin/get-pick-list.sh | tee picklist
10 #
11 # The output is as follows:
12 # [nomination_type] commit_sha commit summary
13
14 is_stable_nomination()
15 {
16 git show --summary "$1" | grep -q -i -o "CC:.*mesa-stable"
17 }
18
19 # Use the last branchpoint as our limit for the search
20 latest_branchpoint=`git merge-base origin/master HEAD`
21
22 # Grep for commits with "cherry picked from commit" in the commit message.
23 git log --reverse --pretty=medium --grep="cherry picked from commit" $latest_branchpoint..HEAD |\
24 grep "cherry picked from commit" |\
25 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
26
27 # Grep for commits that were marked as a candidate for the stable tree.
28 git log --reverse --pretty=%H -i --grep='^CC:.*mesa-stable' $latest_branchpoint..origin/master |\
29 while read sha
30 do
31 # Check to see whether the patch is on the ignore list.
32 if [ -f bin/.cherry-ignore ] ; then
33 if grep -q ^$sha bin/.cherry-ignore ; then
34 continue
35 fi
36 fi
37
38 # Check to see if it has already been picked over.
39 if grep -q ^$sha already_picked ; then
40 continue
41 fi
42
43 if is_stable_nomination "$sha"; then
44 tag=stable
45 else
46 continue
47 fi
48
49 printf "[ %8s ] " "$tag"
50 git --no-pager show --summary --oneline $sha
51 done
52
53 rm -f already_picked