]> git.ozlabs.org Git - next-scripts/commitdiff
split messag_helper out
authorStephen Rothwell <sfr@canb.auug.org.au>
Fri, 30 Nov 2012 00:46:01 +0000 (11:46 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 30 Nov 2012 00:46:01 +0000 (11:46 +1100)
build_msg
build_warn
merge_msg
message_helper [new file with mode: 0755]

index 6cff217bd4e0584a8f834472eaad93e18fb15eb8..f684d150331b6194f1951f44fcd59c0c1b8ef0b6 100755 (executable)
--- a/build_msg
+++ b/build_msg
@@ -1,27 +1,9 @@
 #!/bin/bash
 
-log=../merge.log
-[ -f merge.log ] && log=merge.log
-control=../real_control
-[ -f real_control ] && control=real_control
-
-branch=""
-[ "$1" = "-t" ] && {
-        branch=$2
-        shift 2
-}
-
-[ "$branch" ] || {
-       branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//')
-       branch=${branch%%/*}
-}
+subject="build failure after merge of the BRANCH tree"
+body="After merging the BRANCH tree, today's linux-next build ()%0A\
+failed like this:"
 
-contact=$(awk -F '     ' '$3=="'"$branch"'" { print $1; }' $control)
-greeting=${contact%% *}
-greeting=${greeting#\"}
-[ "${contact%,*}" = "${contact}" ] || greeting="all"
+$(dirname $0)/message_helper "$@" "$subject" "$body"
 
-sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: build failure after merge of the $branch tree&Body=Hi $greeting,%0A\
-%0A\
-After merging the $branch tree, today's linux-next build ()%0A\
-failed like this:"
+exit 0
index c8108f2e79aa4b127aa1b3ea1d051cd81fce30fa..c4d5ed64d7570e5f0e850838aa64871c47ae6f22 100755 (executable)
@@ -1,27 +1,9 @@
 #!/bin/bash
 
-log=../merge.log
-[ -f merge.log ] && log=merge.log
-control=../real_control
-[ -f real_control ] && control=real_control
-
-branch=""
-[ "$1" = "-t" ] && {
-        branch=$2
-        shift 2
-}
-
-[ "$branch" ] || {
-       branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//')
-       branch=${branch%%/*}
-}
+subject="build warning after merge of the BRANCH tree"
+body="After merging the BRANCH tree, today's linux-next build ()%0A\
+produced this warning:"
 
-contact=$(awk -F '     ' '$3=="'"$branch"'" { print $1; }' $control)
-greeting=${contact%% *}
-greeting=${greeting#\"}
-[ "${contact%,*}" = "${contact}" ] || greeting="all"
+$(dirname $0)/message_helper "$@" "$subject" "$body"
 
-sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: build warning after merge of the $branch tree&Body=Hi $greeting,%0A\
-%0A\
-After merging the $branch tree, today's linux-next build ()%0A\
-produced this warning:"
+exit 0
index e436cd5f24307db791c114777a440e397e3fd82e..626cf943460a1bd7a8b36a28217f53596cdfeeab 100755 (executable)
--- a/merge_msg
+++ b/merge_msg
@@ -1,36 +1,29 @@
 #!/bin/bash
 
-log=../merge.log
-[ -f merge.log ] && log=merge.log
-control=../real_control
-[ -f real_control ] && control=real_control
-
 branch=""
 [ "$1" = "-t" ] && {
-        branch=$2
+        branch="-t $2"
         shift 2
 }
 
-[ "$branch" ] || {
-       branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//')
-       branch=${branch%%/*}
-}
-
-contact=$(awk -F '     ' '$3=="'"$branch"'" { print $1; }' $control)
-greeting=${contact%% *}
-greeting=${greeting#\"}
-[ "${contact%,*}" = "${contact}" ] || greeting="all"
-
 file="$*"
 
 gitk --merge -- $file &
 [ "$file" ] && gvim $file
 
-sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: manual merge of the $branch tree with the  tree&Body=Hi $greeting,%0A\
-%0A\
-Today's linux-next merge of the $branch tree got a conflict in $file between commit  (%22%22) from the  tree and commit  (%22%22) from the $branch tree.%0A\
+conf="a conflict"
+[ "$#" -gt 1 ] && {
+       file=${file// /, }
+       file=$(echo $file | sed 's/,\([^,]*\)$/ and\1/')
+       conf="conflicts"
+}
+
+subject="manual merge of the BRANCH tree with the  tree"
+body="Today's linux-next merge of the BRANCH tree got $conf in $file between commit  (%22%22) from the  tree and commit  (%22%22) from the BRANCH tree.%0A\
 %0A\
 I fixed it up (see below) and can carry the fix as necessary (no action%0A\
 is required)."
 
+$(dirname $0)/message_helper $branch "$subject" "$body"
+
 exit 0
diff --git a/message_helper b/message_helper
new file mode 100755 (executable)
index 0000000..3d9e80c
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+log=../merge.log
+[ -f merge.log ] && log=merge.log
+control=../real_control
+[ -f real_control ] && control=real_control
+
+branch=""
+[ "$1" = "-t" ] && {
+        branch=$2
+        shift 2
+}
+
+[ "$branch" ] || {
+       branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//')
+       branch=${branch%%/*}
+}
+
+contact=$(awk -F '     ' '$3=="'"$branch"'" { print $1; }' $control)
+greeting=${contact%% *}
+greeting=${greeting#\"}
+[ "${contact%,*}" = "${contact}" ] || greeting="all"
+
+subject="${1//BRANCH/$branch}"
+body="${2//BRANCH/$branch}"
+
+sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: $subject&Body=Hi $greeting,%0A\
+%0A\
+$body"
+
+exit 0