summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2019-01-28 14:42:12 -0500
committergumi <git@gumi.ca>2019-01-28 15:21:27 -0500
commitb71c0ed7ea48d6426b087c926b8615ebfaea9a52 (patch)
tree161c6ab839de0bada6c6638f43135b06e213b838
parent1850363602a1cac604655f0408a218866b20d7f4 (diff)
downloadevol-tools-s20190211.tar.gz
evol-tools-s20190211.tar.bz2
evol-tools-s20190211.tar.xz
evol-tools-s20190211.zip
make the hercules wrapper output merge errors to a logs20190408s20190311s20190211
-rw-r--r--herculeswrapper/include.sh36
1 files changed, 28 insertions, 8 deletions
diff --git a/herculeswrapper/include.sh b/herculeswrapper/include.sh
index 19201ab..f48e765 100644
--- a/herculeswrapper/include.sh
+++ b/herculeswrapper/include.sh
@@ -178,6 +178,24 @@ function git_merge {
"$@"
}
+ wipe_logs()
+ {
+ echo -e "$(now)\n===\n" > $merge_log
+ chmod +r $merge_log
+ }
+
+ do_git()
+ {
+ info '$' "git $@"
+ echo -e "${PWD##*/} $ git $@" >> $merge_log
+ git "$@" 2> >(tee -a $merge_log >&2)
+ ec=$?
+
+ # print a newline to logs on error
+ if [[ $ec != 0 ]]; then echo "" >> $merge_log; fi
+ return $ec
+ }
+
try_merge()
{
test -n "$1"
@@ -196,13 +214,13 @@ function git_merge {
warning already $branch
return
fi
- if run git merge --ff-only $branch $commit
+ if git merge-base --is-ancestor $branch $commit && do_git merge --ff-only $branch $commit
then
good2 fast $branch $commit >> $motd
good fast $branch $commit
return
fi
- if run git merge $branch $commit
+ if do_git merge $branch $commit
then
good2 merge $branch $commit >> $motd
good merge $branch $commit
@@ -219,8 +237,10 @@ function git_merge {
run test -f $motd
echo -e 'function\tscript\tMOTD_debug_text\t{\n setarray $@Debug_Messages$[0],' > $motd
- run git fetch --all
- run git reset --hard $server_main_branch
+ merge_log=${tmw_tools}/herculeswrapper/stderr.log
+ wipe_logs
+ do_git fetch --all
+ do_git reset --hard $server_main_branch
info 'commit=$(' git rev-parse --verify -q $server_main_branch ')'
commit=$(git rev-parse --verify -q $server_main_branch)
info2 server base $server_main_branch $commit >> $motd
@@ -232,8 +252,8 @@ function git_merge {
run cd $client_data
# force new master and back up for future restoration
- run git fetch --all
- run git reset --hard $client_main_branch
+ do_git fetch --all
+ do_git reset --hard $client_main_branch
info 'commit=$(' git rev-parse --verify -q $client_main_branch ')'
commit=$(git rev-parse --verify -q $client_main_branch)
@@ -245,8 +265,8 @@ function git_merge {
run cd $evol_music
- run git fetch --all
- run git reset --hard $music_main_branch
+ do_git fetch --all
+ do_git reset --hard $music_main_branch
info 'commit=$(' git rev-parse --verify -q $music_main_branch ')'
commit=$(git rev-parse --verify -q $music_main_branch)
info2 music base $music_main_branch $commit >> $motd