]> git.ozlabs.org Git - next-scripts/blob - message_helper
split messag_helper out
[next-scripts] / message_helper
1 #!/bin/bash
2
3 log=../merge.log
4 [ -f merge.log ] && log=merge.log
5 control=../real_control
6 [ -f real_control ] && control=real_control
7
8 branch=""
9 [ "$1" = "-t" ] && {
10         branch=$2
11         shift 2
12 }
13
14 [ "$branch" ] || {
15         branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//')
16         branch=${branch%%/*}
17 }
18
19 contact=$(awk -F '      ' '$3=="'"$branch"'" { print $1; }' $control)
20 greeting=${contact%% *}
21 greeting=${greeting#\"}
22 [ "${contact%,*}" = "${contact}" ] || greeting="all"
23
24 subject="${1//BRANCH/$branch}"
25 body="${2//BRANCH/$branch}"
26
27 sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: $subject&Body=Hi $greeting,%0A\
28 %0A\
29 $body"
30
31 exit 0