+ msg "pushing ${NAME} to local master"
+ run ${REPO_DIR} git fetch local_master --tags
+ run ${REPO_DIR} git fetch local_master
+ merge_all_branches $REPO_DIR $NAME local_master
+ if [ -n "$FAILED_CMDS" ]; then
+ pushd ${REPO_DIR} > /dev/null
+ STATUS_OUT=$(git status)
+ popd > /dev/null
+ # format mail body
+ body="STATUS in ${REPO_DIR}:\n${STATUS_OUT} \n\n------------\n FAILED COMMANDS:\n"
+ for line in "${FAILED_CMDS[@]}"; do body="$body$line\n"; done
+ notify $REPO_DIR "git-mirror.sh failed on with module ${NAME}" "$body"
+ return
+ fi
+ run ${REPO_DIR} git push --tags local_master
+ push_all_branches $REPO_DIR $NAME local_master origin
+ if [ -n "$FAILED_CMDS" ]; then
+ # format mail body
+ body="FAILED COMMANDS:\n"
+ for line in "${FAILED_CMDS[@]}"; do body="$body$line\n"; done
+ notify $REPO_DIR "git-mirror.sh failed to push back with module ${NAME}" "$body"
+ return
+ fi
+ # success, remove previous check file if any
+ clear_notify $REPO_DIR
+ # touch a stamp so it's easier to figure out where/if things get stuck
+ touch ${REPO_DIR}/MIRRORED.stamp
+}
+
+function usage () {
+ echo "Usage $COMMAND [options] REPONAME*"
+ echo " [-a admin-mails] : provide space-separated admins emails"
+ echo " [-r remote-git-url] : e.g. -r git://git.onelab.eu/"
+ echo " [-q] quiet mode for running under cron"
+ echo " [-v] verbose mode"
+ echo " [-f] force mode, runs even if the lock file is present"
+ echo " see also manage-git-mirror.sh"
+ exit 1
+}
+
+while getopts "a:r:s:qvfh" opt; do