bin/get-pick-list.sh: handle "typod" usecase.
[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 is_typod_nomination()
20 {
21 git show --summary "$1" | grep -q -i -o "CC:.*mesa-dev"
22 }
23
24 # Use the last branchpoint as our limit for the search
25 latest_branchpoint=`git merge-base origin/master HEAD`
26
27 # Grep for commits with "cherry picked from commit" in the commit message.
28 git log --reverse --pretty=medium --grep="cherry picked from commit" $latest_branchpoint..HEAD |\
29 grep "cherry picked from commit" |\
30 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
31
32 # Grep for commits that were marked as a candidate for the stable tree.
33 git log --reverse --pretty=%H -i --grep='^CC:.*mesa-stable\|^CC:.*mesa-dev' $latest_branchpoint..origin/master |\
34 while read sha
35 do
36 # Check to see whether the patch is on the ignore list.
37 if [ -f bin/.cherry-ignore ] ; then
38 if grep -q ^$sha bin/.cherry-ignore ; then
39 continue
40 fi
41 fi
42
43 # Check to see if it has already been picked over.
44 if grep -q ^$sha already_picked ; then
45 continue
46 fi
47
48 if is_stable_nomination "$sha"; then
49 tag=stable
50 elif is_typod_nomination "$sha"; then
51 tag=typod
52 else
53 continue
54 fi
55
56 printf "[ %8s ] " "$tag"
57 git --no-pager show --summary --oneline $sha
58 done
59
60 rm -f already_picked