-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrepo-pull.sh
More file actions
executable file
·53 lines (41 loc) · 1.63 KB
/
Copy pathrepo-pull.sh
File metadata and controls
executable file
·53 lines (41 loc) · 1.63 KB
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
#!/usr/bin/env bash
#-----------------------------------------------------------------------------------------------------------------------
# Description: This script updates the repos necessary to build the TDS application. Typically, this script will
# be run from the TDS_Build directory, which will create all of the cloned repos in tds-build's sibling repositiries
# directory. It leverages the same clone-repos.txt file for the project information.
# Unlike repo-update.sh this will pull the latest remote origin changes on the current branch rather than checking
# out a specific branch for each repository.
#
# Pre-requisites: Git, a file list of repos, ssh keys
#
# Usage:
# ./repo-pull.sh
#
#-----------------------------------------------------------------------------------------------------------------------
REPO_LIST_FILE="clone-repos.txt"
if [ ! -f $REPO_LIST_FILE ]; then
printf "Repository list file %s does not exist. exiting.\n" "$REPO_LIST_FILE"
exit
fi
FILECONTENT=( `cat $REPO_LIST_FILE` )
if [ "${PWD##*/}" = "TDS_Build" ]; then
cd ..
fi
if [ -d "repositories" ]; then
printf "A repositories directory exists.\n"
else
printf "A repositories directory does not exist. Shutting down.\n"; exit
fi
cd repositories
pwd
printf "TDS repositories will be updated using the current branch\n"
for REPO_NAME in "${FILECONTENT[@]}"; do
cd $REPO_NAME
CURRENT_BRANCH=`git branch | grep \*`
CMD="git pull"
printf "\n=== executing... %s in %s on branch %s ===\n" "$CMD" "$REPO_NAME" "$CURRENT_BRANCH"
$CMD
printf "\n===== Change folder back to repositories... %s ===\n"
cd ..
pwd
done