Skip to content

Commit d779922

Browse files
committed
Add auto-merge script
1 parent 385000a commit d779922

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

maintainer/auto-merge

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
current=$(git symbolic-ref --short HEAD)
4+
if [[ "$current" != "merge" && "$current" != "merge-test" ]]; then
5+
echo "Error: not on merge or merge-test!" >&2
6+
exit 1
7+
fi
8+
9+
echo "Auto merging on $current ..."
10+
11+
git diff --quiet
12+
13+
if [[ $? -ne 0 ]]; then
14+
echo "Error: tree is not clean!" >&2
15+
exit 1
16+
fi
17+
18+
set -e
19+
20+
now=$(date "+%Y-%m-%d %H:%M")
21+
22+
if [[ "$current" == "merge" ]]; then
23+
branches="master fixes next"
24+
upstream="master"
25+
else
26+
branches="master fixes-test next-test topic/ppc-kvm"
27+
upstream="merge"
28+
git reset --hard merge
29+
fi
30+
31+
for branch in $branches
32+
do
33+
rc=0
34+
git merge --no-ff -m "Automatic merge of '$branch' into $current ($now)" $branch || rc=1
35+
if [[ $rc -ne 0 ]]; then
36+
echo "Automatic merge failed! Spawning bash, fixup and then exit 0 to continue."
37+
bash
38+
39+
if [[ $? -ne 0 ]]; then
40+
echo "Aborting!"
41+
exit 1
42+
fi
43+
fi
44+
done

0 commit comments

Comments
 (0)