-
Notifications
You must be signed in to change notification settings - Fork 3
/
gitall
executable file
·102 lines (85 loc) · 2.24 KB
/
gitall
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
#
# This is a small script to execute a git command on all git repositories configured for devup
#
# Author: Stefan Hepp <hepp@complang.tuwien.ac.at>
#
# Synopsis: fullpath=$(abspath ${relpath})
# Takes a relative file name and prints the absolute path, with symlinks resolved
# Note: readlink -f does not work on OS X; this is a portable replacement
function abspath() {
local path=$1
local pwd_restore="$(pwd)"
local dir=$(dirname "$path")
if [ -d "$dir" ]; then
cd "$dir"
path=$(basename "$path")
# follow chain of symlinks
while [ -L "$path" ]; do
path=$(readlink "$path")
cd $(dirname "$path")
path=$(basename "$path")
done
echo "$(pwd -P)/$path"
cd "$pwd_restore"
elif [[ "$BUILDDIR_SUFFIX" =~ ^/ ]]; then
echo $path
else
echo "Trying to resolve non-existent relative path $path, don't want to use PWD."
exit 1
fi
}
# avoid changing into CDPATH directories
unset CDPATH
# TODO alternatively check home for devup.cfg?
self=`abspath $0`
cfgfile=`dirname $self`/devup.cfg
base=`dirname $self`/..
##### Configuration starts here. Overwrite defaults in ./devup.cfg #####
#
# This script shares the configuration file with the devup script.
# It uses the GITREPOS and GITBASE config options.
#
# By default assume that all other repositories are checked out into the parent
# directory of this folder. Set repository names and the git base dir
# in 'devup.cfg' in the same folder as this script to your setup if you have a
# different directory layout.
#
# Base directory of git checkouts
GITBASE=$base
# Names of git subdirectories in $GITBASE
GITREPOS="patmos bench newlib compiler-rt gold llvm/tools/clang llvm misc argo aegean poseidon"
# Color codes
RED="\033[31m"
NOCOLOR="\033[0m"
##### Configuration ends here #####
if [ -f $cfgfile ]; then
. $cfgfile
fi
function usage() {
echo "Usage: $0 <git command>"
echo
}
while [ ! -z "$1" ]; do
case $1 in
-h|--help)
usage
exit 0
;;
*)
break
;;
esac
shift
done
for repo in $GITREPOS; do
echo -e "====$RED $repo$NOCOLOR ===="
pushd $GITBASE/$repo >/dev/null
if [ $? != 0 ]; then
echo -e "no$RED $repo$NOCOLOR directory, skipping..."
continue
fi
git "$@"
popd >/dev/null
echo
done