-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull
More file actions
executable file
·52 lines (42 loc) · 1.09 KB
/
pull
File metadata and controls
executable file
·52 lines (42 loc) · 1.09 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
51
52
#!/bin/sh
# Script to allow for git/git-svn or svn updates to be pulled for the current directory with all of it's sub directories.
BASE_DIR=`pwd`
function gitBranchName() {
git status 2> /dev/null | sed 's!On branch\ \(.*\)! \1!' | sed '2,$d'
}
function doGitPull() {
cd $1
echo "[INFO] Updating \033[1;34m$1\033[0m: \033[1;32m$(gitBranchName)\033[0m"
if grep -q "svn" $1/.git/config
then
echo "[INFO] Fetching Updates"
git svn fetch
echo "[INFO] Using Git SVN rebase for update"
git svn rebase
else
git fetch
git pull --rebase
fi
}
function doSvnUpdate() {
cd $1
echo "[INFO] SVN update for: $1"
svn up
}
function updateGitDirs() {
echo "[INFO] Updating GIT Repos"
find $BASE_DIR -type d -name .git \
| xargs -n 1 dirname \
| sort \
| while read line; do doGitPull $line; done
}
function updateSvnDirs() {
echo "[INFO] Updating SVN Repos"
find $BASE_DIR -type d -name .svn \
| xargs -n 1 dirname \
| sort \
| while read line; do doSvnUpdate $line; done
}
updateGitDirs
updateSvnDirs
echo "[INFO] Completed update of all repos in $BASE_DIR"