HADOOP-11911. test-patch should allow configuration of default branch (Sean 
Busbey via aw)


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

Branch: refs/heads/HDFS-7240
Commit: 9b01f81eb874cd63e6b9ae2d09d94fc8bf4fcd7d
Parents: 3810242
Author: Allen Wittenauer <a...@apache.org>
Authored: Tue May 5 09:59:20 2015 -0700
Committer: Allen Wittenauer <a...@apache.org>
Committed: Tue May 5 09:59:31 2015 -0700

----------------------------------------------------------------------
 dev-support/test-patch.sh                       | 21 ++++++++++++--------
 hadoop-common-project/hadoop-common/CHANGES.txt |  3 +++
 2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/9b01f81e/dev-support/test-patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.sh b/dev-support/test-patch.sh
index b6e1b03..5107718 100755
--- a/dev-support/test-patch.sh
+++ b/dev-support/test-patch.sh
@@ -43,6 +43,7 @@ function setup_defaults
   ECLIPSE_HOME=${ECLIPSE_HOME:-}
   BUILD_NATIVE=${BUILD_NATIVE:-true}
   PATCH_BRANCH=""
+  PATCH_BRANCH_DEFAULT="trunk"
   CHANGED_MODULES=""
   USER_MODULE_LIST=""
   OFFLINE=false
@@ -551,7 +552,8 @@ function hadoop_usage
   echo
   echo "Options:"
   echo "--basedir=<dir>        The directory to apply the patch to (default 
current directory)"
-  echo "--branch=<dir>         Forcibly set the branch"
+  echo "--branch=<ref>         Forcibly set the branch"
+  echo "--branch-default=<ref> If the branch isn't forced and we don't detect 
one in the patch name, use this branch (default 'trunk')"
   echo "--build-native=<bool>  If true, then build native components (default 
'true')"
   echo "--debug                If set, then output some extra stuff to stderr"
   echo "--dirty-workspace      Allow the local git workspace to have 
uncommitted changes"
@@ -604,6 +606,9 @@ function parse_args
       --branch=*)
         PATCH_BRANCH=${i#*=}
       ;;
+      --branch-default=*)
+        PATCH_BRANCH_DEFAULT=${i#*=}
+      ;;
       --build-native=*)
         BUILD_NATIVE=${i#*=}
       ;;
@@ -832,9 +837,9 @@ function git_checkout
       cleanup_and_exit 1
     fi
 
-    ${GIT} checkout --force trunk
+    ${GIT} checkout --force "${PATCH_BRANCH_DEFAULT}"
     if [[ $? != 0 ]]; then
-      hadoop_error "ERROR: git checkout --force trunk is failing"
+      hadoop_error "ERROR: git checkout --force ${PATCH_BRANCH_DEFAULT} is 
failing"
       cleanup_and_exit 1
     fi
 
@@ -859,8 +864,8 @@ function git_checkout
       cleanup_and_exit 1
     fi
 
-    # we need to explicitly fetch in case the
-    # git ref hasn't been brought in tree yet
+    # if we've selected a feature branch that has new changes
+    # since our last build, we'll need to rebase to see those changes.
     if [[ ${OFFLINE} == false ]]; then
       ${GIT} pull --rebase
       if [[ $? != 0 ]]; then
@@ -1011,7 +1016,7 @@ function verify_valid_branch
 ## @stability    evolving
 ## @replaceable  no
 ## @return       0 on success, with PATCH_BRANCH updated appropriately
-## @return       1 on failure, with PATCH_BRANCH updated to "trunk"
+## @return       1 on failure, with PATCH_BRANCH updated to 
PATCH_BRANCH_DEFAULT
 function determine_branch
 {
   local allbranches
@@ -1075,7 +1080,7 @@ function determine_branch
     fi
   done
 
-  PATCH_BRANCH=trunk
+  PATCH_BRANCH="${PATCH_BRANCH_DEFAULT}"
 
   popd >/dev/null
 }
@@ -1365,7 +1370,7 @@ function check_reexec
 
   exec "${PATCH_DIR}/dev-support-test/test-patch.sh" \
     --reexec \
-    --branch ${PATCH_BRANCH} \
+    --branch "${PATCH_BRANCH}" \
     --patch-dir="${PATCH_DIR}" \
       "${USER_PARAMS[@]}"
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9b01f81e/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt 
b/hadoop-common-project/hadoop-common/CHANGES.txt
index 8b0e67c..49106ae 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -530,6 +530,9 @@ Release 2.8.0 - UNRELEASED
 
     HADOOP-11120. hadoop fs -rmr gives wrong advice. (Juliet Hougland via wang)
 
+    HADOOP-11911. test-patch should allow configuration of default branch
+    (Sean Busbey via aw)
+
   OPTIMIZATIONS
 
     HADOOP-11785. Reduce the number of listStatus operation in distcp

Reply via email to