-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscm-update.sh
More file actions
37 lines (34 loc) · 764 Bytes
/
Copy pathscm-update.sh
File metadata and controls
37 lines (34 loc) · 764 Bytes
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
#!/bin/sh
# Update all Git and Subversion repositories under the current directory.
# by Mike McQuaid (https://github.com/mikemcquaid/scripts)
CURRENT=$PWD
# Set to newline to loop over find output correctly on spaced paths.
IFS="
"
echorun() {
echo + "$@"
$*
}
for SCM in $(find $CURRENT -name .git) $(find $CURRENT -name .svn)
do
DIRECTORY=$(dirname $SCM)
cd $DIRECTORY
if [ -d ../.svn ] || echo $DIRECTORY | grep -q "vendor/ruby"
then
continue
fi
echo == Updating $(basename $DIRECTORY)
if [ -d .git/svn ]
then
echorun git svn fetch
echorun git svn rebase
elif [ -d .git ]
then
echorun git fetch --all
[ -n "$(git remote -v)" ] && echorun git pull
elif [ -d .svn ]
then
echorun svn update
fi
echo
done