-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommit_helper.sh
executable file
·48 lines (41 loc) · 1.26 KB
/
commit_helper.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# Takes a newly generated fail_expectations and attempts to merge/commit it into
# the repository
set -euv
new_expectations="$1"
file="$2"
buildername="$3"
buildnumber="$4"
changeset="$5"
export GIT_SSH=./buildslave_ssh
# check if push is necessary
if diff "${new_expectations}" "${file}" >& /dev/null; then
echo "No differences"
exit 0
fi
# ensure 'origin' remote is set
git remote rm origin || true
git remote add origin git@github.com:libfirm/testresults.git
# construct commit message
TCM="tmp_commit_message.txt"
echo "buildbot update ${buildername} ${buildnumber}" >${TCM}
echo "" >>${TCM}
echo "Revisions used:" >>${TCM}
echo "$changeset" | sed -e "s/;/\n/g" -e "s/=/ = /g" >>${TCM}
echo "" >>${TCM}
echo "See: http://buildbot.info.uni-karlsruhe.de/builders/${buildername// /%20}/builds/${buildnumber}" >>${TCM}
# locally commit changes
cp "${new_expectations}" "${file}"
git add "${file}"
git config user.email "firm@ipd.info.uni-karlsruhe.de"
git config user.name "buildbot"
git commit --file=${TCM} || exit 0
rm ${TCM}
# publish changes
while ! git push origin master -u; do
echo "Out-of-date: " $(git describe --always --tags)
git fetch origin
git rebase origin/master -s recursive -X theirs
echo "Updated to: " $(git describe --always --tags)
done