push-to-trunk.sh: correctly detect existing branches, git-rm deleted files

Review URL: http://codereview.chromium.org/7886004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9256 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent aae949ba
...@@ -74,11 +74,11 @@ confirm() { ...@@ -74,11 +74,11 @@ confirm() {
} }
delete_branch() { delete_branch() {
local MATCH=$(git branch | grep $1) local MATCH=$(git branch | grep $1 | awk '{print $NF}' )
if [ "$MATCH" == "$1" ] ; then if [ "$MATCH" == "$1" ] ; then
confirm "Branch $1 exists, do you want to delete it?" confirm "Branch $1 exists, do you want to delete it?"
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
git branch -D $1 git branch -D $1 || die "Deleting branch '$1' failed."
echo "Branch $1 deleted." echo "Branch $1 deleted."
else else
die "Can't continue. Please delete branch $1 and try again." die "Can't continue. Please delete branch $1 and try again."
...@@ -352,10 +352,17 @@ if [ $STEP -le 13 ] ; then ...@@ -352,10 +352,17 @@ if [ $STEP -le 13 ] ; then
echo ">>> Step 13: Apply squashed changes." echo ">>> Step 13: Apply squashed changes."
patch -p1 < "$PATCH_FILE" | tee >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE") patch -p1 < "$PATCH_FILE" | tee >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE")
[[ $? -eq 0 ]] || die "Applying the patch to trunk failed." [[ $? -eq 0 ]] || die "Applying the patch to trunk failed."
# Stage added and modified files.
TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE") TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE")
for FILE in $TOUCHED_FILES ; do for FILE in $TOUCHED_FILES ; do
git add "$FILE" git add "$FILE"
done 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 "$PATCH_FILE" rm -f "$PATCH_FILE"
rm -f "$TOUCHED_FILES_FILE" rm -f "$TOUCHED_FILES_FILE"
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment