ISIS-1465: enhancing interim-release.sh to automatically cleanrremote branches 
and push new branch (and tag)


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f2f7cedc
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f2f7cedc
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f2f7cedc

Branch: refs/heads/master
Commit: f2f7cedca09ac0fef0aebafd1aa8aaa7684a3b47
Parents: 66f67c2
Author: Dan Haywood <d...@haywood-associates.co.uk>
Authored: Fri Sep 9 00:15:31 2016 +0200
Committer: Dan Haywood <d...@haywood-associates.co.uk>
Committed: Fri Sep 9 00:52:29 2016 +0200

----------------------------------------------------------------------
 interim-release.sh | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/f2f7cedc/interim-release.sh
----------------------------------------------------------------------
diff --git a/interim-release.sh b/interim-release.sh
index ea2231b..34dacb8 100644
--- a/interim-release.sh
+++ b/interim-release.sh
@@ -1,8 +1,10 @@
+#!/bin/bash
 VERSION_BASE=$1
+REMOTE=$2
 
-if [ ! "$VERSION_BASE" ]; then
-    echo "usage: $(basename $0) [base version]"
-    echo "   eg: $(basename $0) 1.13.0"
+if [ -z "$VERSION_BASE" -o -z "$REMOTE" ]; then
+    echo "usage: $(basename $0) [base version] [remote]"
+    echo "   eg: $(basename $0) 1.13.0 incodehq"
     exit 1
 fi
 
@@ -12,6 +14,13 @@ VERSION="$VERSION_BASE.$DATE"
 BRANCH="interim/$VERSION"
 TAG="isis-$VERSION"
 
+echo "removing any earlier (local) 'interim' branches"
+for a in `git branch --list | grep interim`
+do
+    git branch -D $a
+done
+
+echo "checking out new branch $BRANCH"
 git checkout -b "$BRANCH"
 
 echo "updating version in all pom.xml files..."
@@ -24,3 +33,16 @@ git commit -am "bumping to $VERSION"
 
 echo "tagging"
 git tag $TAG
+
+echo "removing any earlier remote branches"
+for a in `git ls-remote --heads $REMOTE  | sed 's?.*refs/heads/??' | grep 
interim`
+do
+    git push $REMOTE --delete $a
+done
+
+echo "pushing tag"
+git push $REMOTE $TAG
+
+echo "pushing branch"
+git push $REMOTE $BRANCH
+

Reply via email to