From 195fa158cc25ad98722f3bbd375e54c9ccf83b95 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Fri, 1 Jun 2012 16:03:30 -0400 Subject: [PATCH] Changed setup script to pull instead of clone if the repo already exists. --- create-dev-env.sh | 54 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/create-dev-env.sh b/create-dev-env.sh index a45fc0dba0..c0a052ba04 100755 --- a/create-dev-env.sh +++ b/create-dev-env.sh @@ -48,21 +48,45 @@ EO clone_repos() { cd "$BASE" - output "Cloning mitx" - if [[ -d "$BASE/mitx" ]]; then - mv "$BASE/mitx" "${BASE}/mitx.bak.$$" - fi - git clone git@github.com:MITx/mitx.git >>$LOG - output "Cloning askbot-devel" - if [[ -d "$BASE/askbot-devel" ]]; then - mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$" - fi - git clone git@github.com:MITx/askbot-devel >>$LOG - output "Cloning data" - if [[ -d "$BASE/data" ]]; then - mv "$BASE/data" "${BASE}/data.bak.$$" - fi - hg clone ssh://hg-content@gp.mitx.mit.edu/data >>$LOG + + if [[ -d "$BASE/mitx/.git" ]]; then + output "Pulling mitx" + cd "$BASE/mitx" + git pull >>$LOG + else + output "Cloning mitx" + if [[ -d "$BASE/mitx" ]]; then + mv "$BASE/mitx" "${BASE}/mitx.bak.$$" + fi + git clone git@github.com:MITx/mitx.git >>$LOG + fi + + cd "$BASE" + if [[ -d "$BASE/askbot-devel/.git" ]]; then + output "Pulling askbot-devel" + cd "$BASE/askbot-devel" + git pull >>$LOG + else + output "Cloning askbot-devel" + if [[ -d "$BASE/askbot-devel" ]]; then + mv "$BASE/askbot-devel" "${BASE}/askbot-devel.bak.$$" + fi + git clone git@github.com:MITx/askbot-devel >>$LOG + fi + + cd "$BASE" + if [[ -d "$BASE/data/.hg" ]]; then + output "Pulling data" + cd "$BASE/data" + hg pull >>$LOG + hg update >>$LOG + else + output "Cloning data" + if [[ -d "$BASE/data" ]]; then + mv "$BASE/data" "${BASE}/data.bak.$$" + fi + hg clone ssh://hg-content@gp.mitx.mit.edu/data >>$LOG + fi } PROG=${0##*/}