Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: tools/push-to-trunk.sh

Issue 7886004: push-to-trunk.sh: correctly detect existing branches, git-rm deleted files (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 80col nit Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright 2011 the V8 project authors. All rights reserved. 2 # Copyright 2011 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 echo -n "$1 [Y/n] " 67 echo -n "$1 [Y/n] "
68 read ANSWER 68 read ANSWER
69 if [[ -z "$ANSWER" || "$ANSWER" == "Y" || "$ANSWER" == "y" ]] ; then 69 if [[ -z "$ANSWER" || "$ANSWER" == "Y" || "$ANSWER" == "y" ]] ; then
70 return 0 70 return 0
71 else 71 else
72 return 1 72 return 1
73 fi 73 fi
74 } 74 }
75 75
76 delete_branch() { 76 delete_branch() {
77 local MATCH=$(git branch | grep $1) 77 local MATCH=$(git branch | grep $1 | awk '{print $NF}' )
78 if [ "$MATCH" == "$1" ] ; then 78 if [ "$MATCH" == "$1" ] ; then
79 confirm "Branch $1 exists, do you want to delete it?" 79 confirm "Branch $1 exists, do you want to delete it?"
80 if [ $? -eq 0 ] ; then 80 if [ $? -eq 0 ] ; then
81 git branch -D $1 81 git branch -D $1 || die "Deleting branch '$1' failed."
82 echo "Branch $1 deleted." 82 echo "Branch $1 deleted."
83 else 83 else
84 die "Can't continue. Please delete branch $1 and try again." 84 die "Can't continue. Please delete branch $1 and try again."
85 fi 85 fi
86 fi 86 fi
87 } 87 }
88 88
89 # Persist and restore variables to support canceling/resuming execution 89 # Persist and restore variables to support canceling/resuming execution
90 # of this script. 90 # of this script.
91 persist() { 91 persist() {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if [ $STEP -le 12 ] ; then 345 if [ $STEP -le 12 ] ; then
346 echo ">>> Step 12: Create a new branch from trunk." 346 echo ">>> Step 12: Create a new branch from trunk."
347 git checkout -b $TRUNKBRANCH svn/trunk \ 347 git checkout -b $TRUNKBRANCH svn/trunk \
348 || die "Checking out a new branch '$TRUNKBRANCH' failed." 348 || die "Checking out a new branch '$TRUNKBRANCH' failed."
349 fi 349 fi
350 350
351 if [ $STEP -le 13 ] ; then 351 if [ $STEP -le 13 ] ; then
352 echo ">>> Step 13: Apply squashed changes." 352 echo ">>> Step 13: Apply squashed changes."
353 patch -p1 < "$PATCH_FILE" | tee >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE") 353 patch -p1 < "$PATCH_FILE" | tee >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE")
354 [[ $? -eq 0 ]] || die "Applying the patch to trunk failed." 354 [[ $? -eq 0 ]] || die "Applying the patch to trunk failed."
355 # Stage added and modified files.
355 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE") 356 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE")
356 for FILE in $TOUCHED_FILES ; do 357 for FILE in $TOUCHED_FILES ; do
357 git add "$FILE" 358 git add "$FILE"
358 done 359 done
360 # Stage deleted files.
361 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \
362 | awk '{print $NF}')
363 for FILE in $DELETED_FILES ; do
364 git rm "$FILE"
365 done
359 rm -f "$PATCH_FILE" 366 rm -f "$PATCH_FILE"
360 rm -f "$TOUCHED_FILES_FILE" 367 rm -f "$TOUCHED_FILES_FILE"
361 fi 368 fi
362 369
363 if [ $STEP -le 14 ] ; then 370 if [ $STEP -le 14 ] ; then
364 echo ">>> Step 14: Set correct version for trunk." 371 echo ">>> Step 14: Set correct version for trunk."
365 restore_if_unset "MAJOR" 372 restore_if_unset "MAJOR"
366 restore_if_unset "MINOR" 373 restore_if_unset "MINOR"
367 restore_if_unset "BUILD" 374 restore_if_unset "BUILD"
368 sed -e "/#define MAJOR_VERSION/s/[0-9]*$/$MAJOR/" \ 375 sed -e "/#define MAJOR_VERSION/s/[0-9]*$/$MAJOR/" \
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 echo ">>> Step 20: Done!" 422 echo ">>> Step 20: Done!"
416 restore_if_unset "MAJOR" 423 restore_if_unset "MAJOR"
417 restore_if_unset "MINOR" 424 restore_if_unset "MINOR"
418 restore_if_unset "BUILD" 425 restore_if_unset "BUILD"
419 echo "Congratulations, you have successfully created the trunk revision \ 426 echo "Congratulations, you have successfully created the trunk revision \
420 $MAJOR.$MINOR.$BUILD. Please don't forget to update the v8rel spreadsheet, \ 427 $MAJOR.$MINOR.$BUILD. Please don't forget to update the v8rel spreadsheet, \
421 and to roll this new version into Chromium." 428 and to roll this new version into Chromium."
422 # Clean up all temporary files. 429 # Clean up all temporary files.
423 rm -f "$PERSISTFILE_BASENAME"* 430 rm -f "$PERSISTFILE_BASENAME"*
424 fi 431 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698