forked from kiegroup/droolsjbpm-build-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-all.sh
executable file
·68 lines (57 loc) · 2.18 KB
/
git-all.sh
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
#!/bin/bash
# Runs a git command on all droolsjbpm repositories.
initializeWorkingDirAndScriptDir() {
# Set working directory and remove all symbolic links
workingDir=`pwd -P`
# Go the script directory
cd `dirname $0`
# If the file itself is a symbolic link (ignoring parent directory links), then follow that link recursively
# Note that scriptDir=`pwd -P` does not do that and cannot cope with a link directly to the file
scriptFileBasename=`basename $0`
while [ -L "$scriptFileBasename" ] ; do
scriptFileBasename=`readlink $scriptFileBasename` # Follow the link
cd `dirname $scriptFileBasename`
scriptFileBasename=`basename $scriptFileBasename`
done
# Set script directory and remove other symbolic links (parent directory links)
scriptDir=`pwd -P`
}
initializeWorkingDirAndScriptDir
droolsjbpmOrganizationDir="$scriptDir/../.."
if [ $# = 0 ] ; then
echo
echo "Usage:"
echo " $0 [arguments of git]"
echo "For example:"
echo " $0 fetch"
echo " $0 pull --rebase"
echo " $0 commit -m\"JIRAKEY-1 Fix typo\""
echo
exit 1
fi
startDateTime=`date +%s`
cd "$droolsjbpmOrganizationDir"
for repository in `cat "${scriptDir}/repository-list.txt"` ; do
echo
if [ ! -d "$droolsjbpmOrganizationDir/$repository" ]; then
echo "==============================================================================="
echo "Missing Repository: $repository. SKIPPING!"
echo "==============================================================================="
else
echo "==============================================================================="
echo "Repository: $repository"
echo "==============================================================================="
cd $repository
git "$@"
returnCode=$?
cd ..
if [ $returnCode != 0 ] ; then
echo -n "Error executing command for repository ${repository}. Should I continue? (Hit control-c to stop or enter to continue): "
read ok
fi
fi
done
endDateTime=`date +%s`
spentSeconds=`expr $endDateTime - $startDateTime`
echo
echo "Total time: ${spentSeconds}s"