You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2014/10/28 10:58:21 UTC

git commit: Revert "HADOOP-10926. Improve test-patch.sh to apply binary diffs (cmccabe)"

Repository: hadoop
Updated Branches:
  refs/heads/trunk 0398db19b -> c9bec46c9


Revert "HADOOP-10926. Improve test-patch.sh to apply binary diffs (cmccabe)"

This reverts commit b0e19c9d54cecef191b91431f9ca62a76a000f45.


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

Branch: refs/heads/trunk
Commit: c9bec46c92cc4df8d3247a3f235c303c8ae94655
Parents: 0398db1
Author: Steve Loughran <st...@apache.org>
Authored: Tue Oct 28 09:58:01 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Oct 28 09:58:01 2014 +0000

----------------------------------------------------------------------
 dev-support/smart-apply-patch.sh                | 37 ++++----------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  2 --
 2 files changed, 7 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9bec46c/dev-support/smart-apply-patch.sh
----------------------------------------------------------------------
diff --git a/dev-support/smart-apply-patch.sh b/dev-support/smart-apply-patch.sh
index 0475490..49f083c 100755
--- a/dev-support/smart-apply-patch.sh
+++ b/dev-support/smart-apply-patch.sh
@@ -37,31 +37,11 @@ if [ "$PATCH_FILE" == "-" ]; then
   TOCLEAN="$TOCLEAN $PATCH_FILE"
 fi
 
-# Was the patch generated by git?  If so, we can definitely use 'git apply' to
-# apply it.  This is nice because it allows us to handle binary files.  If
-# not, we fall back to applying the patch with "patch", since that's most
-# likely what was used to create it.
-if git --version &>/dev/null && grep -q -- '^diff --git' "$PATCH_FILE"; then
-    PATCH_TYPE="git"
-    PATCH_DRY_RUN="git apply --check"
-    PATCH_APPLY="git apply"
-else
-    PATCH_TYPE="non-git"
-    PATCH_DRY_RUN="patch --dry-run -E"
-    PATCH_APPLY="patch -E"
-fi
-
 # Come up with a list of changed files into $TMP
 TMP=/tmp/tmp.paths.$$
 TOCLEAN="$TOCLEAN $TMP"
 
-# This file contains the error messages from all patch application attempts.
-# We only print it when the script fails.
-DRY_RUN_ERRORS=/tmp/dry-run-errors.$$
-TOCLEAN="$TOCLEAN $DRY_RUN_ERRORS"
-touch $DRY_RUN_ERRORS
-
-if $PATCH_DRY_RUN -p0 < $PATCH_FILE 2>>$DRY_RUN_ERRORS 1> $TMP; then
+if $PATCH -p0 -E --dry-run < $PATCH_FILE 2>&1 > $TMP; then
   PLEVEL=0
   #if the patch applied at P0 there is the possability that all we are doing
   # is adding new files and they would apply anywhere. So try to guess the
@@ -79,7 +59,7 @@ if $PATCH_DRY_RUN -p0 < $PATCH_FILE 2>>$DRY_RUN_ERRORS 1> $TMP; then
 
   #first off check that all of the files do not exist
   FOUND_ANY=0
-  for CHECK_FILE in $(cat -- $TMP2)
+  for CHECK_FILE in $(cat $TMP2)
   do
     if [[ -f $CHECK_FILE ]]; then
       FOUND_ANY=1
@@ -117,15 +97,12 @@ if $PATCH_DRY_RUN -p0 < $PATCH_FILE 2>>$DRY_RUN_ERRORS 1> $TMP; then
       cleanup 1
     fi
   fi
-elif $PATCH_DRY_RUN -p1 < $PATCH_FILE 2>>$DRY_RUN_ERRORS 1> /dev/null; then
+elif $PATCH -p1 -E --dry-run < $PATCH_FILE 2>&1 > /dev/null; then
   PLEVEL=1
-elif $PATCH_DRY_RUN -p2 < $PATCH_FILE 2>>$DRY_RUN_ERRORS 1> /dev/null; then
+elif $PATCH -p2 -E --dry-run < $PATCH_FILE 2>&1 > /dev/null; then
   PLEVEL=2
 else
-  echo "The ${PATCH_TYPE} patch does not appear to apply with p0 to p2.";
-  echo
-  echo "Dry run errors:"
-  cat -- $DRY_RUN_ERRORS
+  echo "The patch does not appear to apply with p0 to p2";
   cleanup 1;
 fi
 
@@ -134,7 +111,7 @@ if [[ -n $DRY_RUN ]]; then
   cleanup 0;
 fi
 
-echo Going to apply ${PATCH_TYPE} patch with: ${PATCH_APPLY} -p$PLEVEL
-${PATCH_APPLY} -p$PLEVEL < $PATCH_FILE
+echo Going to apply patch with: $PATCH -p$PLEVEL
+$PATCH -p$PLEVEL -E < $PATCH_FILE
 
 cleanup $?

http://git-wip-us.apache.org/repos/asf/hadoop/blob/c9bec46c/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 6ab4d62..bdbf89e 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -137,8 +137,6 @@ Trunk (Unreleased)
 
     HADOOP-11231. Remove dead code in ServletUtil. (Li Lu via wheat9)
 
-    HADOOP-10926. Improve test-patch.sh to apply binary diffs. (cmccabe)
-
   BUG FIXES
 
     HADOOP-9451. Fault single-layer config if node group topology is enabled.