You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2016/06/23 18:29:51 UTC

[2/3] hbase git commit: HBASE-15725 make_patch.sh should add the branch name when -b is passed.

HBASE-15725 make_patch.sh should add the branch name when -b is passed.


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

Branch: refs/heads/branch-1
Commit: c7e5672d4d3d6a44ac01c0a56e122a58994846de
Parents: 28d1706
Author: Elliott Clark <ec...@apache.org>
Authored: Thu May 12 11:15:57 2016 -0700
Committer: Elliott Clark <ec...@apache.org>
Committed: Thu Jun 23 11:29:27 2016 -0700

----------------------------------------------------------------------
 dev-support/make_patch.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c7e5672d/dev-support/make_patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/make_patch.sh b/dev-support/make_patch.sh
index 446c0a5..0aedf88 100755
--- a/dev-support/make_patch.sh
+++ b/dev-support/make_patch.sh
@@ -24,7 +24,7 @@ while getopts "ahd:b:" opt; do
     case "$opt" in
         a)  addendum='-addendum'
             ;;
-        d)  
+        d)
             patch_dir=$OPTARG
             ;;
         b)
@@ -52,7 +52,7 @@ fi
 # Exit if git status is dirty
 git_dirty=$(git diff --shortstat 2> /dev/null | wc -l|awk {'print $1'})
 echo "git_dirty is $git_dirty"
-if [ "$git_dirty" -ne 0 ]; then  
+if [ "$git_dirty" -ne 0 ]; then
     echo "Git status is dirty. Commit locally first.">&2
     exit 1
 fi
@@ -117,8 +117,15 @@ elif  [ "$status" -ge 1 ]; then
         fi
     done
 fi
+# If this is against a tracking branch other than master
+# include it in the patch name
+tracking_suffix=""
+if [[ $tracking_branch != "origin/master" \
+    &&  $tracking_branch != "master" ]]; then
+    tracking_suffix="-${tracking_branch#origin/}"
+fi
 
-patch_name="$branch$prefix$addendum.patch"
+patch_name="$branch$prefix$addendum$tracking_suffix.patch"
 
 # Do we need to make a diff?
 git diff --quiet $tracking_branch
@@ -134,10 +141,10 @@ local_commits=$(git log $tracking_branch..$branch|grep 'Author:'|wc -l|awk {'pri
 if [ "$local_commits" -gt 1 ]; then
     read -p "$local_commits commits exist only in your local branch. Interactive rebase?" yn
     case $yn in
-        [Yy]* ) 
+        [Yy]* )
             git rebase -i $tracking_branch
                 ;;
-        [Nn]* ) 
+        [Nn]* )
           echo "Creating $patch_dir/$patch_name using git diff."
           git diff $tracking_branch > $patch_dir/$patch_name
           exit 0
@@ -147,5 +154,3 @@ fi
 
 echo "Creating patch $patch_dir/$patch_name using git format-patch"
 git format-patch --stdout $tracking_branch > $patch_dir/$patch_name
-
-