-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint
54 lines (45 loc) · 1.28 KB
/
entrypoint
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
#!/bin/bash
#####################################################
# Download Specific folders from Github using SVN
#
# Orginal Author: Declan Cook
# Modified by: MarketingPip from github.com/MarketingPipeline
# Licence: MIT
#####################################################
GHDOMAIN="https://github.com/"
IN=$1
FILEPATH=$2
OVERWRITE=$3
IN=${IN##$GHDOMAIN}
BRANCH="trunk"
FOLDER=""
IFS="/" read -a SECT <<< "$IN"
### File Path Option
if [ -z "$FILEPATH" ]
then
echo "\FILEPATH option was not chosen, files will be moved into main repo folder"
FILEPATH="./"
else
echo "\FILEPATH option was chosen, files will be moved into $FILEPATH if it exists"
FILEPATH=$FILEPATH
fi
### Overwrite files
if [ -z "$OVERWRITE"]
then
echo "\OVERWRITE option was not chosen, files will not be overwritten"
OVERWRITE=""
else
echo "\OVERWRITE option was chosen, files will be overwritten"
OVERWRITE="--force"
fi
if [[ "${SECT[3]}" != "master" ]]; then
BRANCH=${SECT[3]}
fi
for index in "${!SECT[@]}"; do
if [ $index -gt 3 ]; then
FOLDER=$FOLDER/${SECT[index]}
fi
done
# DOMAIN/USER/PROJECT/<TRUNK||BRANCH>/FOLDER
echo Exporting $GHDOMAIN${SECT[0]}/${SECT[1]}/$BRANCH$FOLDER
svn $OVERWRITE export $GHDOMAIN${SECT[0]}/${SECT[1]}/$BRANCH$FOLDER $FILEPATH