diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-05 15:00:50 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-05 15:00:50 -0500 |
commit | 88dfc651d599bdfe4f900d08f5dc95d2f0725b99 (patch) | |
tree | 2176c2fd9281345c32155039d4e711f26d6d17a0 /switch_all_submodules_to_head_and_clean | |
parent | c9f0b9f32181c62df2bbdf77de9ae47a6544288e (diff) | |
download | scripts-88dfc651d599bdfe4f900d08f5dc95d2f0725b99.tar.gz scripts-88dfc651d599bdfe4f900d08f5dc95d2f0725b99.zip |
Add switch_all_submodules_to_head_and_clean script for developers
Diffstat (limited to 'switch_all_submodules_to_head_and_clean')
-rwxr-xr-x | switch_all_submodules_to_head_and_clean | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/switch_all_submodules_to_head_and_clean b/switch_all_submodules_to_head_and_clean new file mode 100755 index 0000000..15e1076 --- /dev/null +++ b/switch_all_submodules_to_head_and_clean @@ -0,0 +1,41 @@ +#!/bin/bash + +if [[ ! -d .git ]]; then + echo "This script can only be run from a top level git directory. Exiting..." + exit 1 +fi + +echo "Preparing $PWD for development use" +if [[ $1 == "" ]]; then + read -p "Enter your TDE GIT username []: " -e gituser +fi + +if [[ $gituser == "" ]]; then + gituser="anonymous" +fi + +THISSCRIPT=$(readlink -f $0) +echo "$THISSCRIPT" +exit 1 + +if [[ ! -e "$THISSCRIPT" ]]; then + echo "Unable to find myself! Exiting..." + exit 1 +fi + +git reset --hard HEAD +git clean -dxf + +if [[ -e .gitmodules ]]; then + if [[ $1 == "anonymous" ]]; then + sed -i 's/system@//g' .gitmodules + else + sed -i "s/system@/$1@/g" .gitmodules + fi + + git submodule init + git submodule update + git submodule foreach "'git checkout master && git pull && $THISSCRIPT $1'" + + git checkout -- .gitmodules +fi |