git://git.onelab.eu
/
infrastructure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
93d5e58
)
report the status (conflict) and failed commands
author
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Thu, 14 Oct 2010 13:29:00 +0000
(15:29 +0200)
committer
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Thu, 14 Oct 2010 13:29:00 +0000
(15:29 +0200)
scripts/git-mirror.sh
patch
|
blob
|
history
diff --git
a/scripts/git-mirror.sh
b/scripts/git-mirror.sh
index
42ab22c
..
8ebae5b
100755
(executable)
--- a/
scripts/git-mirror.sh
+++ b/
scripts/git-mirror.sh
@@
-6,6
+6,7
@@
MASTER_GIT="/git"
LOCAL_MIRROR_DIR="/git-mirror"
QUIET=0
FAILED=0
LOCAL_MIRROR_DIR="/git-mirror"
QUIET=0
FAILED=0
+FAILED_CMDS=""
function msg () {
if [ $QUIET -eq 0 ]
function msg () {
if [ $QUIET -eq 0 ]
@@
-15,9
+16,11
@@
function msg () {
}
function error () {
}
function error () {
+ SUBJECT=$1
+ MSG=$2
for admin in $ADMINS
do
for admin in $ADMINS
do
- echo
"[ERROR] xxxxxxxxxxx $@" | mail -s "$@
" $admin
+ echo
-e "$MSG" | mail -s "$SUBJECT
" $admin
done
}
done
}
@@
-36,14
+39,17
@@
function run () {
if [ $? -ne 0 ]
then
FAILED=1
if [ $? -ne 0 ]
then
FAILED=1
+ FAILED_CMDS="$FAILED_CMDS\n$COMMAND"
fi
popd > /dev/null
}
function run_ignore_errors () {
OLD_FAILED=$FAILED
fi
popd > /dev/null
}
function run_ignore_errors () {
OLD_FAILED=$FAILED
+ OLD_FAILED_CMDS=$FAILED_CMDS
run "$1" "$2"
FAILED=$OLD_FAILED
run "$1" "$2"
FAILED=$OLD_FAILED
+ FAILED_CMDS=$OLD_FAILED_CMDS
}
function merge_all_branches () {
}
function merge_all_branches () {
@@
-117,7
+123,10
@@
function mirror () {
merge_all_branches $NAME local_master $REPO_DIR
if [ $FAILED -ne 0 ]
then
merge_all_branches $NAME local_master $REPO_DIR
if [ $FAILED -ne 0 ]
then
- error "git-mirror.sh failed on ${MIRROR_REPO}"
+ pushd ${REPO_DIR} > /dev/null
+ STATUS_OUT=$(git status)
+ popd > /dev/null
+ error "git-mirror.sh failed on ${MIRROR_REPO}" "STATUS:\n$STATUS_OUT \n\n------------\n FAILED COMMANDS:\n$FAILED_CMDS"
else
run "git push --tags local_master" ${REPO_DIR}
push_all_branches $NAME local_master $REPO_DIR
else
run "git push --tags local_master" ${REPO_DIR}
push_all_branches $NAME local_master $REPO_DIR