Reviewers: Jakob,

Description:
merge-to-branch.sh should correctly handle added/deleted files


[email protected]


Please review this at https://chromiumcodereview.appspot.com/9315055/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M tools/merge-to-branch.sh


Index: tools/merge-to-branch.sh
diff --git a/tools/merge-to-branch.sh b/tools/merge-to-branch.sh
index ef7cee4b38227f3e0fcd22c64750159e81db29c8..1154e56305c4de570e2a757be65679b906e3420e 100755
--- a/tools/merge-to-branch.sh
+++ b/tools/merge-to-branch.sh
@@ -233,11 +233,25 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then
   restore_if_unset "MERGE_TO_BRANCH"
   restore_patch_commit_hashes_if_unset "PATCH_COMMIT_HASHES"
   echo "${PATCH_COMMIT_HASHES[@]}"
- echo ">>> Step $CURRENT_STEP: Apply the revision patch and create commit message."
+  echo ">>> Step $CURRENT_STEP: Apply patches for selected revisions."
+  rm -f "$TOUCHED_FILES_FILE"
   for HASH in ${PATCH_COMMIT_HASHES[@]} ; do
     git log -1 -p $HASH | patch -p1 \
-      || die "Cannot apply the patch for $HASH to $MERGE_TO_BRANCH"
+      | tee >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE")
+    [[ $? -eq 0 ]] || die "Applying the patch to trunk failed."
   done
+  # 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"
 fi

 let CURRENT_STEP+=1


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

Reply via email to