This repository has been archived by the owner on Nov 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_twqa_gaiauitests.sh
executable file
·81 lines (66 loc) · 2.21 KB
/
update_twqa_gaiauitests.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# Program:
# This program is intended to update the gaia-ui-tests from Mozilla/gaia-ui-tests
#
# History:
# 2013/06/21 Walter Chen Support config files and all branches now
# 2013/05/14 Walter Chen Modified it to do auto clone if folder not existed
# 2013/05/03 Walter Chen Added some log information to go with crontab
# 2013/05/02 Walter Chen Created this file
# helper_config function
function helper_config(){
echo -e "The config file error."
echo -e "\tfilename: .auto_update_gaiatest.conf"
echo -e "\t===== File Content ====="
echo -e "\tBranches=\"master,v1-train,v1.0.1\""
echo -e "\t========================"
}
echo "Started to synchronize TW-QA gaia-ui-tests"
date
#############################################
# Load Config File (before load parameters) #
#############################################
export IFS=","
CONFIG_FILE=.auto_update_gaiatest.conf
if [ -f "$CONFIG_FILE" ]; then
. $CONFIG_FILE
else
helper_config
exit -2
fi
if [ -z "$Branches" ]; then
helper_config
exit -2
fi
#############################################
# Pull New Codes From Mozilla Gaia-ui-test #
#############################################
# see if the folder exists
test -d ${1}
if [ $? == 1 ]; then
echo "You haven't clone it yet. Now doing clone"
git clone https://github.com/Mozilla-TWQA/gaia-ui-tests.git ${1}
fi
cd ${1}
# add mozilla gaia-ui-tests remote
if [ $(git remote show | grep mozilla-gaiauitests -c) == 1 ]; then
git remote rm mozilla-gaiauitests
fi
git remote add mozilla-gaiauitests https://github.com/mozilla/gaia-ui-tests.git
for branch in $Branches; do
echo $branch
# update the branch
git checkout $branch
git pull --rebase mozilla-gaiauitests $branch
# update the matching tw-modified branch
branch_to_update=tw-modified-${branch}
if [ $(git branch | grep ${branch_to_update} -c) == 1 ]; then
git branch -D $branch_to_update
fi
git checkout -b $branch_to_update origin/$branch_to_update
git pull --rebase mozilla-gaiauitests $branch
done
git checkout master
git remote set-url origin git@github.com:Mozilla-TWQA/gaia-ui-tests.git
git push
echo "Finished synchronizing TW-QA gaia-ui-tests"