blob: f292d3ec8b5c749033653d2c65e464022b306df8 [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
Emil Velikova57d1af2017-02-13 00:13:55 +000013latest_branchpoint=`git merge-base origin/master HEAD`
Emil Velikovc212a702015-09-02 17:36:22 +010014
15# Grep for commits with "cherry picked from commit" in the commit message.
16git log --reverse --grep="cherry picked from commit" $latest_branchpoint..HEAD |\
17 grep "cherry picked from commit" |\
18 sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' |\
19 cut -c -8 |\
20while read sha
21do
22 # Check if the original commit is referenced in master
23 git log -n1 --pretty=oneline --grep=$sha $latest_branchpoint..origin/master |\
24 cut -c -8 |\
25 while read candidate
26 do
27 # Check if the potential fix, hasn't landed in branch yet.
28 found=`git log -n1 --pretty=oneline --reverse --grep=$candidate $latest_branchpoint..HEAD |wc -l`
29 if test $found = 0
30 then
31 echo Commit $candidate might need to be picked, as it references $sha
32 fi
33 done
34done