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# Use the last branchpoint as our limit for the search
12latest_branchpoint=`git merge-base origin/master HEAD`
13
14# Grep for commits with "cherry picked from commit" in the commit message.
15git log --reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD |\
16	grep "cherry picked from commit" |\
17	sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
18
19# Grep for commits that were marked as a candidate for the stable tree.
20git log --reverse --pretty=%H -i --grep='^CC:.*mesa-stable' $latest_branchpoint..origin/master |\
21while read sha
22do
23	# Check to see whether the patch is on the ignore list.
24	if [ -f bin/.cherry-ignore ] ; then
25		if grep -q ^$sha bin/.cherry-ignore ; then
26			continue
27		fi
28	fi
29
30	# Check to see if it has already been picked over.
31	if grep -q ^$sha already_picked ; then
32		continue
33	fi
34
35	git log -n1 --pretty=oneline $sha | cat
36done
37
38rm -f already_picked
39