Revision: 12663
Author:   [email protected]
Date:     Fri Oct  5 01:58:02 2012
Log: push-to-trunk.sh/merge-to-branch.sh: use "git apply" instead of "patch" to apply patches

Review URL: https://codereview.chromium.org/11031065
http://code.google.com/p/v8/source/detail?r=12663

Modified:
 /branches/bleeding_edge/tools/common-includes.sh
 /branches/bleeding_edge/tools/merge-to-branch.sh
 /branches/bleeding_edge/tools/push-to-trunk.sh

=======================================
--- /branches/bleeding_edge/tools/common-includes.sh Thu Sep 20 01:02:17 2012 +++ /branches/bleeding_edge/tools/common-includes.sh Fri Oct 5 01:58:02 2012
@@ -36,9 +36,7 @@
 VERSION_FILE="src/version.cc"
 CHANGELOG_ENTRY_FILE="$PERSISTFILE_BASENAME-changelog-entry"
 PATCH_FILE="$PERSISTFILE_BASENAME-patch"
-PATCH_OUTPUT_FILE="$PERSISTFILE_BASENAME-patch-output"
 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg"
-TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files"
 TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision"
 START_STEP=0
 CURRENT_STEP=0
@@ -181,8 +179,8 @@
 }

 wait_for_resolving_conflicts() {
-  echo "Applying the patch failed. Either type \"ABORT<Return>\", or \
-resolve the conflicts, stage the touched files with 'git add' and \
+ echo "Applying the patch \"$1\" failed. Either type \"ABORT<Return>\", or \
+resolve the conflicts, stage *all* touched files with 'git add', and \
 type \"RESOLVED<Return>\""
   unset ANSWER
   while [ "$ANSWER" != "RESOLVED" ] ; do
@@ -195,24 +193,6 @@

 # Takes a file containing the patch to apply as first argument.
 apply_patch() {
-  patch $REVERSE_PATCH -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \
-    { cat "$PATCH_OUTPUT_FILE" && wait_for_resolving_conflicts; }
-  tee < "$PATCH_OUTPUT_FILE" >(grep "patching file" \
- | awk '{print $NF}'
"$TOUCHED_FILES_FILE")
-  rm "$PATCH_OUTPUT_FILE"
-}
-
-stage_files() {
-  # Stage added and modified files.
-  TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE")
-  for FILE in $TOUCHED_FILES ; do
-    git add "$FILE"
-  done
-  # Stage deleted files.
-  DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \
-                                                 | awk '{print $NF}')
-  for FILE in $DELETED_FILES ; do
-    git rm "$FILE"
-  done
-  rm -f "$TOUCHED_FILES_FILE"
+  git apply --index --reject $REVERSE_PATCH "$1" || \
+    wait_for_resolving_conflicts "$1";
 }
=======================================
--- /branches/bleeding_edge/tools/merge-to-branch.sh Wed Sep 26 04:19:35 2012 +++ /branches/bleeding_edge/tools/merge-to-branch.sh Fri Oct 5 01:58:02 2012
@@ -186,7 +186,6 @@
   if [ -n "$EXTRA_PATCH" ] ; then
     apply_patch "$EXTRA_PATCH"
   fi
-  stage_files
 fi

 let CURRENT_STEP+=1
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk.sh      Wed Aug  8 07:57:10 2012
+++ /branches/bleeding_edge/tools/push-to-trunk.sh      Fri Oct  5 01:58:02 2012
@@ -268,7 +268,6 @@
   echo ">>> Step $CURRENT_STEP: Apply squashed changes."
   rm -f "$TOUCHED_FILES_FILE"
   apply_patch "$PATCH_FILE"
-  stage_files
   rm -f "$PATCH_FILE"
 fi

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to