-
Notifications
You must be signed in to change notification settings - Fork 2
/
merge.sh
executable file
·67 lines (60 loc) · 1.29 KB
/
merge.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
usage()
{
cat << EOF
usage: $0 options
This script will checkout a branch of Weld, update JBoss AS with it, and run
all the tests against it. It will then merge the branch to master for final
review. It will not push the branch to upstream.
OPTIONS:
-h Show this usage message
-b The name of the branch to checkout
-m The name of the branch to merge into, by default "master"
-v Be more verbose
EOF
}
work()
{
echo "Checking out $BRANCH"
TMP_LOCAL_BRANCH=tmp_local_branch_$BRANCH
git checkout -b $TMP_LOCAL_BRANCH $BRANCH
git rebase $BASE_BRANCH
echo "Rebased $BRANCH onto $BASE_BRANCH"
echo "Executing $BUILD_COMMAND"
`$BUILD_COMMAND`
git checkout $BASE_BRANCH
echo "Merging $BRANCH into $BASE_BRANCH"
git merge $TMP_LOCAL_BRANCH
git status
}
BRANCH=
VERBOSE=0
RUN=1
BASE_BRANCH="origin/master"
BUILD_COMMAND="mvn clean install && mvn verify -Dincontainer"
while getopts "vhb:m:" OPTION
do
case $OPTION in
h)
usage
RUN=0
;;
b)
BRANCH=$OPTARG
;;
m)
BASE_BRANCH=$OPTARG
;;
v)
VERBOSE=1
;;
[?])
usage;
RUN=0
;;
esac
done
if [ "$RUN" -eq "1" ]
then
work;
fi