You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/03/24 07:40:00 UTC

[5/5] isis git commit: ISIS-1521: enhances github_pr.sh script

ISIS-1521: enhances github_pr.sh script


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

Branch: refs/heads/master
Commit: 6ed4f3b74d9d78da915e13375427bdb9bba239d5
Parents: c5b0bc3
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Mar 24 07:39:27 2017 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri Mar 24 07:39:27 2017 +0000

----------------------------------------------------------------------
 .../guides/_cgcom_merging-a-pull-request.adoc   | 20 ++++-
 github-pr.sh                                    | 78 ++++++++++++++------
 2 files changed, 73 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6ed4f3b7/adocs/documentation/src/main/asciidoc/guides/_cgcom_merging-a-pull-request.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_cgcom_merging-a-pull-request.adoc b/adocs/documentation/src/main/asciidoc/guides/_cgcom_merging-a-pull-request.adoc
index 5e4c4d5..8871a7f 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_cgcom_merging-a-pull-request.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_cgcom_merging-a-pull-request.adoc
@@ -58,14 +58,26 @@ The syntax is:
 
 [source,bash]
 ----
-github-pr.sh isis 1162 31
+github-pr.sh -j 1162 -g 31 [-s] [-p ISIS]
 ----
 
 where:
 
-* `isis` is the JIRA project and repo
-* `1162` is the JIRA ticket number
-* `31`   is the gthub PR issue number
+* `-j 1162` +
++
+is the JIRA ticket number
+
+* `-g 31`   +
++
+is the github PR issue number
+
+* `-s` +
++
+will optionally skip the build and auto-merge
+
+* `-p ISIS` +
++
+optionally overrids the JIRA project (defaults to 'ISIS')
 
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6ed4f3b7/github-pr.sh
----------------------------------------------------------------------
diff --git a/github-pr.sh b/github-pr.sh
index a78dee7..422f40b 100644
--- a/github-pr.sh
+++ b/github-pr.sh
@@ -36,25 +36,52 @@ function die {
 	exit 10
 }
 
+project="ISIS"
+jira_suffix=""
+pr_number=""
+skip_build="false"
 
 #
 # validate script args
 #
-if [ $# -ne 3 ]; then
-    die "usage: github-pr.sh proj nnn pp"
+
+while getopts ":p:j:g:s" opt; do
+  case $opt in
+    p)
+      project=$OPTARG
+      ;;
+    j)
+      jira_suffix=$OPTARG
+      ;;
+    g)
+      pr_number=$OPTARG
+      ;;
+    s)
+      skip_build="true"
+      ;;
+    \?)
+      echo "Invalid option: -$OPTARG" >&2
+      ;;
+  esac
+done
+
+echo ""
+echo "project   : $project"
+echo "ASF jira  : $jira_suffix"
+echo "github PR : $pr_number"
+echo "skip_build: $skip_build"
+echo ""
+
+if [ "$jira_suffix" == "" -o "$pr_number" == "" ]; then
+    die "usage: github-pr.sh -j nnn -g pp [-s] [-p pppp]"
 fi
 
-project=$1
-jira_suffix=$2
-pr_number=$3
+
 project_lower=$(echo $project | tr '[:upper:]' '[:lower:]')
 project_upper=$(echo $project | tr '[:lower:]' '[:upper:]')
 
 jira_number="$project_upper-$jira_suffix"
 
-echo ""
-
-
 #
 # validate JIRA ticket
 #
@@ -127,18 +154,27 @@ echo "Pulling the changes from $repo_clone_url $branch_name_fork"
 git pull $repo_clone_url $branch_name_fork
 
 echo ""
-echo "Merged the PR; hit enter to build"
 
-read 
-echo "Building..."
-echo
 
-mvn clean install -o
-
-echo
-echo
-echo
-echo "If build successful and happy to merge, execute:"
-echo
-echo "git checkout $branch_name_local && git merge --no-ff $branch_name_temp && git branch -d $branch_name_temp"
-echo
+if [ "$skip_build" == "false" ]
+then
+    echo "Merged the PR; hit enter to build"
+    read 
+    echo "Building..."
+    echo
+
+    mvn clean install -o
+
+    echo
+    echo
+    echo
+    echo "If build successful and happy to merge, execute:"
+    echo
+    echo "git checkout $branch_name_local && git merge --no-ff $branch_name_temp && git branch -d $branch_name_temp"
+    echo
+else
+    echo 
+    echo "Merging..."
+    echo 
+    git checkout $branch_name_local && git merge --no-ff $branch_name_temp && git branch -d $branch_name_temp
+fi