hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-14871 Allow specifying the base branch for make_patch
Date Tue, 24 Nov 2015 20:00:03 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 4a60c25c7 -> 4cc341b9c


HBASE-14871 Allow specifying the base branch for make_patch


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

Branch: refs/heads/master
Commit: 4cc341b9c23183fe12225fb03d30ac975a87d07c
Parents: 4a60c25
Author: Elliott Clark <eclark@apache.org>
Authored: Mon Nov 23 16:48:45 2015 -0800
Committer: Elliott Clark <eclark@apache.org>
Committed: Tue Nov 24 11:59:49 2015 -0800

----------------------------------------------------------------------
 dev-support/make_patch.sh | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4cc341b9/dev-support/make_patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/make_patch.sh b/dev-support/make_patch.sh
index ec2bbb9..446c0a5 100755
--- a/dev-support/make_patch.sh
+++ b/dev-support/make_patch.sh
@@ -20,18 +20,22 @@
 # Make a patch for the current branch based on its tracking branch
 
 # Process args
-while getopts "ahd:" opt; do
+while getopts "ahd:b:" opt; do
     case "$opt" in
         a)  addendum='-addendum'
             ;;
         d)  
             patch_dir=$OPTARG
             ;;
+        b)
+            tracking_branch=$OPTARG
+            ;;
         *)
             echo -e "Usage: $0 [-h] [-a] [-d] <directory> \n\
         Must be run from within the git branch to make the patch against.\n\
         -h - display these instructions.\n\
         -a - Add an 'addendum' prefix to the patch name.\n\
+        -b - Specify the base branch to diff from. (defaults to the tracking branch or origin
master)\n\
         -d - specify a patch directory (defaults to ~/patches/)"
             exit 0
             ;;
@@ -53,20 +57,25 @@ if [ "$git_dirty" -ne 0 ]; then
     exit 1
 fi
 
-# Determine the tracking branch
-git log -n 1 origin/$branch > /dev/null 2>&1
-status=$?
-if [ "$status" -eq 128 ]; then
-    # Status 128 means there is no remote branch
-    tracking_branch='origin/master'
-elif [ "$status" -eq 0 ]; then
-    # Status 0 means there is a remote branch
-    tracking_branch="origin/$branch"
-else
-    echo "Unknown error: $?" >&2
-    exit 1
+# Determine the tracking branch if needed.
+# If it was passed in from the command line
+# with -b then use dthat no matter what.
+if [ ! "$tracking_branch" ]; then
+  git log -n 1 origin/$branch > /dev/null 2>&1
+  status=$?
+  if [ "$status" -eq 128 ]; then
+      # Status 128 means there is no remote branch
+      tracking_branch='origin/master'
+  elif [ "$status" -eq 0 ]; then
+      # Status 0 means there is a remote branch
+      tracking_branch="origin/$branch"
+  else
+      echo "Unknown error: $?" >&2
+      exit 1
+  fi
 fi
 
+
 # Deal with invalid or missing $patch_dir
 if [ ! "$patch_dir" ]; then
     echo -e "Patch directory not specified. Falling back to ~/patches/."


Mime
View raw message