From af538cde531e7c37ba58f69ed974bde110c73e58 Mon Sep 17 00:00:00 2001
From: Yves Noirjean <ynoir@bsse-vpn-244.ethz.ch>
Date: Tue, 24 Oct 2017 18:18:52 +0200
Subject: [PATCH] translated tag.sh / tag_and_build_sprint.sh to git

---
 openbis_all/source/bash/build/tag.sh          | 36 ++++++++++---------
 .../source/bash/tag_and_build_sprint.sh       |  9 +++--
 2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/openbis_all/source/bash/build/tag.sh b/openbis_all/source/bash/build/tag.sh
index 52803017293..09c7ee7ea82 100755
--- a/openbis_all/source/bash/build/tag.sh
+++ b/openbis_all/source/bash/build/tag.sh
@@ -5,29 +5,31 @@ if [ $# -ne 2 ]
 then
   echo "Usage: ./tag.sh [branch] [tag]"
   echo ""
-  echo "Example: ./tag.sh release/13.04.x 13.04.1"
+  echo "Example: ./tag.sh 13.04.x 13.04.1"
   exit 1
 fi
 branch=$1
-dir=${2%/*}
-if [ $dir == $2 ]; then
-  dir=$branch
-  tag=$1/$2
-else
-  tag=$2
-fi
+tag=$2
+
+# cd to repository root directory
+cd "$(dirname "$0")/../../../.."
 
-svn info svn+ssh://svncisd.ethz.ch/repos/cisd/openbis_all/branches/$branch 2>/dev/null
+# switch to branch - exit if it does not exist
+git checkout $branch
 if [ $? -ne 0 ]; then echo "Branch does not exist!"; exit 1; fi
+git pull
 
-svn info svn+ssh://svncisd.ethz.ch/repos/cisd/openbis_all/tags/$tag 2>/dev/null
+# exit if tag already exists
+git checkout $tag
 if [ $? -eq 0 ]; then echo "Tag already exists!"; exit 1; fi
 
-svn mkdir --parents svn+ssh://svncisd.ethz.ch/repos/cisd/openbis_all/tags/$dir -m "create tag $tag"
-svn copy svn+ssh://svncisd.ethz.ch/repos/cisd/openbis_all/branches/$branch svn+ssh://svncisd.ethz.ch/repos/cisd/openbis_all/tags/$tag -m "create tag $tag"
 
-rm -rf elntemp
-svn co --depth=immediates svn+ssh://svncisd.ethz.ch/repos/cisd/openbis_all/tags/$tag/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html elntemp
-svn info svn+ssh://svncisd.ethz.ch/repos/cisd/openbis_all/tags/$tag|grep Path|awk -F: '{print $2}'|sed -e 's/ //g' > elntemp/version.txt
-svn add elntemp/version.txt
-svn commit elntemp -m "Added ELN build info to tag $tag"
\ No newline at end of file
+# set version for ELN
+echo $tag > openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/version.txt
+git add openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/version.txt
+git commit -m "Added ELN build info to tag $tag"
+git push
+
+# create tag
+git tag $tag
+git push origin $tag
diff --git a/openbis_all/source/bash/tag_and_build_sprint.sh b/openbis_all/source/bash/tag_and_build_sprint.sh
index 0718b1b8dba..3a36ec98fe3 100755
--- a/openbis_all/source/bash/tag_and_build_sprint.sh
+++ b/openbis_all/source/bash/tag_and_build_sprint.sh
@@ -11,6 +11,8 @@ usage()
  	exit 1
 }
 
+# parameter checks
+
 if [ $# -eq 0 ]
 then
 	usage
@@ -35,13 +37,14 @@ then
 	usage
 fi
 
+# create sprint branch
 if [ ${HOT_FIX_NUMBER} -eq 0 ]
 then
-	"$BIN_DIR/build/branch.sh" sprint/S${1}.x
+	"$BIN_DIR/build/branch.sh" S${1}.x
 	if [ $? -ne 0 ];then exit 1; fi	
 fi
 
-"$BIN_DIR/build/tag.sh" sprint/S${1}.x S${1}.${HOT_FIX_NUMBER}
+"$BIN_DIR/build/tag.sh" S${1}.x S${1}.${HOT_FIX_NUMBER}
 if [ $? -ne 0 ];then exit 1; fi	
 
-"$BIN_DIR/build/build.sh" sprint/S${1}.x S${1}.${HOT_FIX_NUMBER}
\ No newline at end of file
+"$BIN_DIR/build/build.sh" S${1}.x S${1}.${HOT_FIX_NUMBER}
-- 
GitLab