forked from ossimlabs/ossim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
got
executable file
·65 lines (53 loc) · 1.67 KB
/
got
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
#!/bin/bash
###############################################################################
#
# got = git for OSSIM
#
# Convenience script for performing git operations on multiple OSSIMLABS repos.
# Up to four git parameters are handled, for example:
#
# got commit -a
# got log --oneline --graph
#
# Obviously, only commands that make sense to run on all repos will work. You
# can't commit a specific file for example.
#
# Run this script from ossimlabs parent directory (a.k.a. OSSIM_DEV_HOME)
#
###############################################################################
# FUNCTION: do_git <repo_name> <cmd_line_arg_1> <cmd_line_arg_2> <cmd_line_arg_3> <cmd_line_arg_4>
function do_git {
if [ -d $1 ]; then
echo;
echo "*************************** $(basename $1) ***************************"
pushd $1 > /dev/null
git $2 $3 $4 $5
popd > /dev/null
fi
}
export -f do_git
# FUNCTION: usage <script_basename>
function usage {
echo; echo "Runs specified git command across all ossimlabs repositories. Usage:"
echo; echo " $1 <git-arg1> [<git-arg2> [<git-arg3>]]"
echo; echo "This script must be run from the ossimlabs parent directory."
echo; echo "Examples:"; echo
echo " $1 status"
echo " $1 log --oneline --graph"; echo
exit 0
}
# Check for incorrect usage:
if [ -z $1 ]; then
usage `basename "$0"`
fi
# Loop over all ossim repos in working dir:
find . -maxdepth 1 -type d -name "ossim*" -exec bash -c "do_git {} $*" \;
# Check OMAR as well...
if [ -d omar ]; then
bash -c "do_git omar $*"
fi
find . -maxdepth 1 -type d -name "omar-*" -exec bash -c "do_git {} $*" \;
if [ -d o2-paas ]; then
bash -c "do_git o2-paas $*"
fi
echo