From 1e743f3d09cc52cbd36531d3b66a90d5af2fb7c0 Mon Sep 17 00:00:00 2001 From: Chuck Atkins <chuck.atkins@kitware.com> Date: Wed, 5 Apr 2017 17:16:04 -0400 Subject: [PATCH] Added upstream remote in setup script --- scripts/developer/git/setup-aliases | 5 ++--- scripts/developer/git/setup-remotes | 27 +++++++++++++++++++++++++++ scripts/developer/setup.sh | 3 +++ 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100755 scripts/developer/git/setup-remotes diff --git a/scripts/developer/git/setup-aliases b/scripts/developer/git/setup-aliases index 5479ad0dd..2d996582b 100755 --- a/scripts/developer/git/setup-aliases +++ b/scripts/developer/git/setup-aliases @@ -3,14 +3,13 @@ echo "Setting up git aliases..." if ! which clang-format 2>1 1>/dev/null then - echo "ADIOS development requires clang-format to be available in your path." - exit 1 + echo "Warning: ADIOS uses clang-format to enforce style guidelines but no" + echo " clang-format binary was found in tyour path" fi if ! git config alias.clang-format "!scripts/developer/git/git-clang-format" then echo "Error adding clang-format alias" - exit 2 fi exit 0 diff --git a/scripts/developer/git/setup-remotes b/scripts/developer/git/setup-remotes new file mode 100755 index 000000000..6dc9e8605 --- /dev/null +++ b/scripts/developer/git/setup-remotes @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +echo "Checking github username..." +GHUSER=$(git remote get-url origin | sed 's|.*[:/]\([^/]*\)/adios2.git|\1|') +if [ -z "${GHUSER}" ] +then + echo " Warning: Unable to determine github username. Are you sure you" + echo " cloned your fork?" + exit 1 +fi +echo "Using github user ${GHUSER}" + +echo "Adding upstream remote..." +if git remote show upstream > /dev/null 2>&1 +then + echo " Warning: upstream remote already exists; skipping" +else + git remote add upstream https://github.com/ornladios/adios2.git +fi +git fetch --all -p + +echo "Reconfiguring local master branch to use upstream" +git config branch.master.remote upstream +git config branch.master.mergeOptions "--ff-only" +git config merge.log 100 + +exit 0 diff --git a/scripts/developer/setup.sh b/scripts/developer/setup.sh index 27607008e..dc4d903df 100755 --- a/scripts/developer/setup.sh +++ b/scripts/developer/setup.sh @@ -10,6 +10,9 @@ function test_cmd { cd "${BASH_SOURCE%/*}/../.." +test_cmd scripts/developer/git/setup-remotes \ + "Failed to setup upstream remotes " 2 + test_cmd scripts/developer/git/setup-aliases \ "Failed to setup git aliases" 2 -- GitLab