diff options
author | David Cole <david.cole@kitware.com> | 2012-05-01 18:08:14 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-05-01 18:08:14 (GMT) |
commit | 63564847d250913f6021a0c41260c0c769b18e3e (patch) | |
tree | 6b71a811dc9a76f899e78029dde57d329b4896eb /Utilities | |
parent | d9427c9667bc01fce49d0299115a63867ea25a75 (diff) | |
parent | c9072f88cbff819b3414c037b2fefe395ce66d9f (diff) | |
download | CMake-63564847d250913f6021a0c41260c0c769b18e3e.zip CMake-63564847d250913f6021a0c41260c0c769b18e3e.tar.gz CMake-63564847d250913f6021a0c41260c0c769b18e3e.tar.bz2 |
Merge topic 'developer-setup'
c9072f8 Merge branch 'setup' into developer-setup
b7daff9 setup-stage: Optionally reconfigure topic stage
Diffstat (limited to 'Utilities')
-rwxr-xr-x | Utilities/GitSetup/setup-stage | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/Utilities/GitSetup/setup-stage b/Utilities/GitSetup/setup-stage index ef53b99..323e47a 100755 --- a/Utilities/GitSetup/setup-stage +++ b/Utilities/GitSetup/setup-stage @@ -37,17 +37,43 @@ die() { cd "${BASH_SOURCE%/*}" && # Load the project configuration. -url=$(git config -f config --get stage.url) && -pushurl=$(git config -f config --get stage.pushurl || echo '') || +fetchurl=$(git config -f config --get stage.url) && +pushurl_=$(git config -f config --get stage.pushurl || echo '') && +remote=$(git config -f config --get stage.remote || echo 'stage') || die 'This project is not configured to use a topic stage.' -# Configure the remote if necessary. -if git config remote.stage.url >/dev/null; then - echo 'Topic stage already configured.' +# Get current stage push URL. +pushurl=$(git config --get remote."$remote".pushurl || + git config --get remote."$remote".url || echo '') && + +# Tell user about current configuration. +if test -n "$pushurl"; then + echo 'Remote "'"$remote"'" is currently configured to push to + + '"$pushurl"' +' && + read -ep 'Reconfigure Topic Stage? [y/N]: ' ans && + if [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then + setup=1 + else + setup='' + fi else + setup=1 +fi + +# Perform setup if necessary. +if test -n "$setup"; then echo 'Setting up the topic stage...' && - git remote add stage "$url" && - if test -n "$pushurl"; then - git config remote.stage.pushurl "$pushurl" - fi -fi || die 'Could not add the topic stage remote.' + if test -z "$pushurl"; then + git remote add "$remote" "$fetchurl" + else + git config remote."$remote".url "$fetchurl" + fi && + pushurl="${pushurl_}" && + git config remote."$remote".pushurl "$pushurl" && + echo 'Remote "'"$remote"'" is now configured to push to + + '"$pushurl"' +' +fi || die 'Could not configure the topic stage remote.' |