-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclone_mergeable.sh
executable file
·66 lines (41 loc) · 1.12 KB
/
clone_mergeable.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
#!/bin/bash
ARCH=amd64
LOCATION=~/git/mrs
LISTS=(
'mrs'
'nonbloom'
'thirdparty'
)
for ((i=0; i < ${#LISTS[*]}; i++));
do
LIST=${LISTS[$i]}
YAML_FILE=$LIST.yaml
REPOS=$(./scripts/helpers/parse_yaml.py $YAML_FILE $ARCH)
echo $REPOS
mkdir -p $LOCATION/$LIST
echo "$REPOS" | while IFS= read -r REPO; do
cd $LOCATION/$LIST
echo "Cloning $REPO"
PACKAGE=$(echo "$REPO" | awk '{print $1}')
URL=$(echo "$REPO" | awk '{print $2}')
RELEASE_CANDIDATE_BRANCH=$(echo "$REPO" | awk '{print $4}')
UNSTABLE_BRANCH=$(echo "$REPO" | awk '{print $5}')
if [ -e ./$PACKAGE ]; then
echo "$0: repository '$URL' is already present, removing it"
rm -rf ./$PACKAGE
fi
echo "$0: cloning '$URL --branch $BRANCH' into '$PACKAGE'"
git clone $URL --branch $RELEASE_CANDIDATE_BRANCH $PACKAGE
# compare the branches
cd $PACKAGE
git diff-index --quiet origin/$UNSTABLE_BRANCH
retval=$?
if [ $retval -eq 0 ]; then
cd $LOCATION/$LIST
echo "$0: nothing to be merged, deleting the repo"
rm -rf ./$PACKAGE
fi
done
done
echo "Done cloning"
echo $RESULT