vulkan/util: Add generator for enum_to_str functions
[mesa.git] / bin / get-fixes-pick-list.sh
1 #!/bin/bash
2
3 # Script for generating a list of candidates [referenced by a Fixes tag] for
4 # cherry-picking to a stable branch
5 #
6 # Usage examples:
7 #
8 # $ bin/get-fixes-pick-list.sh
9 # $ bin/get-fixes-pick-list.sh > picklist
10 # $ bin/get-fixes-pick-list.sh | tee picklist
11
12 # Use the last branchpoint as our limit for the search
13 latest_branchpoint=`git merge-base origin/master HEAD`
14
15 # List all the commits between day 1 and the branch point...
16 git log --reverse --pretty=%H $latest_branchpoint > already_landed
17
18 # ... and the ones cherry-picked.
19 git log --reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD |\
20 grep "cherry picked from commit" |\
21 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
22
23 # Grep for commits with Fixes tag
24 git log --reverse --pretty=%H -i --grep="fixes:" $latest_branchpoint..origin/master |\
25 while read sha
26 do
27 # For each one try to extract the tag
28 fixes_count=`git show $sha | grep -i "fixes:" | wc -l`
29 if [ "x$fixes_count" != x1 ] ; then
30 echo WARNING: Commit $sha has nore than one Fixes tag
31 fi
32 fixes=`git show $sha | grep -i "fixes:" | head -n 1`
33 # The following sed/cut combination is borrowed from GregKH
34 id=`echo ${fixes} | sed -e 's/^[ \t]*//' | cut -f 2 -d ':' | sed -e 's/^[ \t]*//' | cut -f 1 -d ' '`
35
36 # Bail out if we cannot find suitable id.
37 # Any specific validation the $id is valid and not some junk, is
38 # implied with the follow up code
39 if [ "x$id" = x ] ; then
40 continue
41 fi
42
43 # Check if the offending commit is in branch.
44
45 # Be that cherry-picked ...
46 # ... or landed before the branchpoint.
47 if grep -q ^$id already_picked ||
48 grep -q ^$id already_landed ; then
49
50 # Finally nominate the fix if it hasn't landed yet.
51 if grep -q ^$sha already_picked ; then
52 continue
53 fi
54
55 echo Commit $sha fixes $id
56 fi
57
58 done
59
60 rm -f already_picked
61 rm -f already_landed