OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 BRANCHNAME=prepare-push | 32 BRANCHNAME=prepare-push |
33 TRUNKBRANCH=trunk-push | 33 TRUNKBRANCH=trunk-push |
34 TEMP_BRANCH=v8-push-to-trunk-script-temporary-branch | 34 TEMP_BRANCH=v8-push-to-trunk-script-temporary-branch |
35 VERSION_FILE="src/version.cc" | 35 VERSION_FILE="src/version.cc" |
36 PERSISTFILE_BASENAME=/tmp/v8-push-to-trunk-tempfile | 36 PERSISTFILE_BASENAME=/tmp/v8-push-to-trunk-tempfile |
37 CHANGELOG_ENTRY_FILE="$PERSISTFILE_BASENAME-changelog-entry" | 37 CHANGELOG_ENTRY_FILE="$PERSISTFILE_BASENAME-changelog-entry" |
38 PATCH_FILE="$PERSISTFILE_BASENAME-patch" | 38 PATCH_FILE="$PERSISTFILE_BASENAME-patch" |
39 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg" | 39 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg" |
40 TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files" | 40 TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files" |
| 41 TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision" |
41 STEP=0 | 42 STEP=0 |
42 | 43 |
43 | 44 |
44 ########## Function definitions | 45 ########## Function definitions |
45 | 46 |
46 usage() { | 47 usage() { |
47 cat << EOF | 48 cat << EOF |
48 usage: $0 OPTIONS | 49 usage: $0 OPTIONS |
49 | 50 |
50 Performs the necessary steps for a V8 push to trunk. Only works for \ | 51 Performs the necessary steps for a V8 push to trunk. Only works for \ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 219 |
219 if [ $STEP -le 5 ] ; then | 220 if [ $STEP -le 5 ] ; then |
220 echo ">>> Step 5: Edit ChangeLog entry." | 221 echo ">>> Step 5: Edit ChangeLog entry." |
221 echo -n "Please press <Return> to have your EDITOR open the ChangeLog entry, \ | 222 echo -n "Please press <Return> to have your EDITOR open the ChangeLog entry, \ |
222 then edit its contents to your liking. When you're done, save the file and \ | 223 then edit its contents to your liking. When you're done, save the file and \ |
223 exit your EDITOR. " | 224 exit your EDITOR. " |
224 read ANSWER | 225 read ANSWER |
225 $EDITOR "$CHANGELOG_ENTRY_FILE" | 226 $EDITOR "$CHANGELOG_ENTRY_FILE" |
226 NEWCHANGELOG=$(mktemp) | 227 NEWCHANGELOG=$(mktemp) |
227 # Eliminate any trailing newlines by going through a shell variable. | 228 # Eliminate any trailing newlines by going through a shell variable. |
228 CHANGELOGENTRY=$(cat "$CHANGELOG_ENTRY_FILE") | 229 # Also (1) eliminate tabs, (2) fix too little and (3) too much indentation, |
| 230 # and (4) eliminate trailing whitespace. |
| 231 CHANGELOGENTRY=$(cat "$CHANGELOG_ENTRY_FILE" \ |
| 232 | sed -e 's/\t/ /g' \ |
| 233 | sed -e 's/^ \{1,7\}\([^ ]\)/ \1/g' \ |
| 234 | sed -e 's/^ \{9,80\}\([^ ]\)/ \1/g' \ |
| 235 | sed -e 's/ \+$//') |
229 [[ -n "$CHANGELOGENTRY" ]] || die "Empty ChangeLog entry." | 236 [[ -n "$CHANGELOGENTRY" ]] || die "Empty ChangeLog entry." |
230 echo "$CHANGELOGENTRY" > "$NEWCHANGELOG" | 237 echo "$CHANGELOGENTRY" > "$NEWCHANGELOG" |
231 echo "" >> "$NEWCHANGELOG" # Explicitly insert two empty lines. | 238 echo "" >> "$NEWCHANGELOG" # Explicitly insert two empty lines. |
232 echo "" >> "$NEWCHANGELOG" | 239 echo "" >> "$NEWCHANGELOG" |
233 cat ChangeLog >> "$NEWCHANGELOG" | 240 cat ChangeLog >> "$NEWCHANGELOG" |
234 mv "$NEWCHANGELOG" ChangeLog | 241 mv "$NEWCHANGELOG" ChangeLog |
235 fi | 242 fi |
236 | 243 |
237 if [ $STEP -le 6 ] ; then | 244 if [ $STEP -le 6 ] ; then |
238 echo ">>> Step 6: Increment version number." | 245 echo ">>> Step 6: Increment version number." |
(...skipping 14 matching lines...) Expand all Loading... |
253 persist "NEWMINOR" | 260 persist "NEWMINOR" |
254 NEWBUILD=$(grep "#define BUILD_NUMBER" "$VERSION_FILE" | awk '{print $NF}') | 261 NEWBUILD=$(grep "#define BUILD_NUMBER" "$VERSION_FILE" | awk '{print $NF}') |
255 persist "NEWBUILD" | 262 persist "NEWBUILD" |
256 fi | 263 fi |
257 | 264 |
258 if [ $STEP -le 7 ] ; then | 265 if [ $STEP -le 7 ] ; then |
259 echo ">>> Step 7: Commit to local branch." | 266 echo ">>> Step 7: Commit to local branch." |
260 restore_if_unset "NEWMAJOR" | 267 restore_if_unset "NEWMAJOR" |
261 restore_if_unset "NEWMINOR" | 268 restore_if_unset "NEWMINOR" |
262 restore_if_unset "NEWBUILD" | 269 restore_if_unset "NEWBUILD" |
263 git commit -a -m "Prepare push to trunk. \ | 270 PREPARE_COMMIT_MSG="Prepare push to trunk. \ |
264 Now working on version $NEWMAJOR.$NEWMINOR.$NEWBUILD." \ | 271 Now working on version $NEWMAJOR.$NEWMINOR.$NEWBUILD." |
| 272 persist "PREPARE_COMMIT_MSG" |
| 273 git commit -a -m $PREPARE_COMMIT_MSG \ |
265 || die "'git commit -a' failed." | 274 || die "'git commit -a' failed." |
266 fi | 275 fi |
267 | 276 |
268 if [ $STEP -le 8 ] ; then | 277 if [ $STEP -le 8 ] ; then |
269 echo ">>> Step 8: Upload for code review." | 278 echo ">>> Step 8: Upload for code review." |
270 echo -n "Please enter the email address of a V8 reviewer for your patch: " | 279 echo -n "Please enter the email address of a V8 reviewer for your patch: " |
271 read REVIEWER | 280 read REVIEWER |
272 git cl upload -r $REVIEWER --send-mail \ | 281 git cl upload -r $REVIEWER --send-mail \ |
273 || die "'git cl upload' failed, please try again." | 282 || die "'git cl upload' failed, please try again." |
274 fi | 283 fi |
275 | 284 |
276 if [ $STEP -le 9 ] ; then | 285 if [ $STEP -le 9 ] ; then |
277 echo ">>> Step 9: Commit to the repository." | 286 echo ">>> Step 9: Commit to the repository." |
278 echo "Please wait for an LGTM, then type \"LGTM<Return>\" to commit your \ | 287 echo "Please wait for an LGTM, then type \"LGTM<Return>\" to commit your \ |
279 change. (If you need to iterate on the patch, do so in another shell.)" | 288 change. (If you need to iterate on the patch, do so in another shell. Do not \ |
| 289 modify the existing local commit's commit message.)" |
280 unset ANSWER | 290 unset ANSWER |
281 while [ "$ANSWER" != "LGTM" ] ; do | 291 while [ "$ANSWER" != "LGTM" ] ; do |
282 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." | 292 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." |
283 echo -n "> " | 293 echo -n "> " |
284 read ANSWER | 294 read ANSWER |
285 done | 295 done |
286 # Re-read the ChangeLog entry (to pick up possible changes). | 296 # Re-read the ChangeLog entry (to pick up possible changes). |
287 cat ChangeLog | awk --posix '{ | 297 cat ChangeLog | awk --posix '{ |
288 if ($0 ~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}:/) { | 298 if ($0 ~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}:/) { |
289 if (in_firstblock == 1) { | 299 if (in_firstblock == 1) { |
290 exit 0; | 300 exit 0; |
291 } else { | 301 } else { |
292 in_firstblock = 1; | 302 in_firstblock = 1; |
293 } | 303 } |
294 }; | 304 }; |
295 print $0; | 305 print $0; |
296 }' > "$CHANGELOG_ENTRY_FILE" | 306 }' > "$CHANGELOG_ENTRY_FILE" |
297 git cl dcommit || die "'git cl dcommit' failed, please try again." | 307 git cl dcommit || die "'git cl dcommit' failed, please try again." |
298 fi | 308 fi |
299 | 309 |
300 if [ $STEP -le 10 ] ; then | 310 if [ $STEP -le 10 ] ; then |
301 echo ">>> Step 10: NOP" | 311 echo ">>> Step 10: Fetch straggler commits that sneaked in between \ |
302 # Present in the manual guide, not necessary (even harmful!) for this script. | 312 steps 1 and 9." |
| 313 git svn fetch || die "'git svn fetch' failed." |
| 314 git checkout svn/bleeding_edge |
| 315 restore_if_unset "PREPARE_COMMIT_MSG" |
| 316 PREPARE_COMMIT_HASH=$(git log -1 --format=%H --grep="$PREPARE_COMMIT_MSG") |
| 317 persist "PREPARE_COMMIT_HASH" |
303 fi | 318 fi |
304 | 319 |
305 if [ $STEP -le 11 ] ; then | 320 if [ $STEP -le 11 ] ; then |
306 echo ">>> Step 11: Squash commits into one." | 321 echo ">>> Step 11: Squash commits into one." |
307 # Instead of relying on "git rebase -i", we'll just create a diff, because | 322 # Instead of relying on "git rebase -i", we'll just create a diff, because |
308 # that's easier to automate. | 323 # that's easier to automate. |
309 git diff svn/trunk > "$PATCH_FILE" | 324 restore_if_unset "PREPARE_COMMIT_HASH" |
| 325 git diff svn/trunk $PREPARE_COMMIT_HASH > "$PATCH_FILE" |
310 # Convert the ChangeLog entry to commit message format: | 326 # Convert the ChangeLog entry to commit message format: |
311 # - remove date | 327 # - remove date |
312 # - remove indentation | 328 # - remove indentation |
313 # - merge paragraphs into single long lines, keeping empty lines between them. | 329 # - merge paragraphs into single long lines, keeping empty lines between them. |
314 restore_if_unset "DATE" | 330 restore_if_unset "DATE" |
315 CHANGELOGENTRY=$(cat "$CHANGELOG_ENTRY_FILE") | 331 CHANGELOGENTRY=$(cat "$CHANGELOG_ENTRY_FILE") |
316 echo "$CHANGELOGENTRY" \ | 332 echo "$CHANGELOGENTRY" \ |
317 | sed -e "s/^$DATE: //" \ | 333 | sed -e "s/^$DATE: //" \ |
318 | sed -e 's/^ *//' \ | 334 | sed -e 's/^ *//' \ |
319 | awk '{ | 335 | awk '{ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 if [ $STEP -le 16 ] ; then | 410 if [ $STEP -le 16 ] ; then |
395 echo ">>> Step 16: Sanity check." | 411 echo ">>> Step 16: Sanity check." |
396 confirm "Please check if your local checkout is sane: Inspect $VERSION_FILE, \ | 412 confirm "Please check if your local checkout is sane: Inspect $VERSION_FILE, \ |
397 compile, run tests. Do you want to commit this new trunk revision to the \ | 413 compile, run tests. Do you want to commit this new trunk revision to the \ |
398 repository?" | 414 repository?" |
399 [[ $? -eq 0 ]] || die "Execution canceled." | 415 [[ $? -eq 0 ]] || die "Execution canceled." |
400 fi | 416 fi |
401 | 417 |
402 if [ $STEP -le 17 ] ; then | 418 if [ $STEP -le 17 ] ; then |
403 echo ">>> Step 17. Commit to SVN." | 419 echo ">>> Step 17. Commit to SVN." |
404 git svn dcommit || die "'git svn dcommit' failed." | 420 git svn dcommit | tee >(grep -E "^Committed r[0-9]+" \ |
| 421 | sed -e 's/^Committed r\([0-9]\+\)/\1/' \ |
| 422 > "$TRUNK_REVISION_FILE") \ |
| 423 || die "'git svn dcommit' failed." |
405 fi | 424 fi |
406 | 425 |
407 if [ $STEP -le 18 ] ; then | 426 if [ $STEP -le 18 ] ; then |
408 echo ">>> Step 18: Tag the new revision." | 427 echo ">>> Step 18: Tag the new revision." |
409 restore_if_unset "MAJOR" | 428 restore_if_unset "MAJOR" |
410 restore_if_unset "MINOR" | 429 restore_if_unset "MINOR" |
411 restore_if_unset "BUILD" | 430 restore_if_unset "BUILD" |
412 git svn tag $MAJOR.$MINOR.$BUILD -m "Tagging version $MAJOR.$MINOR.$BUILD" \ | 431 git svn tag $MAJOR.$MINOR.$BUILD -m "Tagging version $MAJOR.$MINOR.$BUILD" \ |
413 || die "'git svn tag' failed." | 432 || die "'git svn tag' failed." |
414 fi | 433 fi |
415 | 434 |
416 if [ $STEP -le 19 ] ; then | 435 if [ $STEP -le 19 ] ; then |
417 echo ">>> Step 19: Cleanup." | 436 echo ">>> Step 19: Cleanup." |
418 restore_if_unset "CURRENT_BRANCH" | 437 restore_if_unset "CURRENT_BRANCH" |
419 git checkout -f $CURRENT_BRANCH | 438 git checkout -f $CURRENT_BRANCH |
420 [[ "$TEMP_BRANCH" != "$CURRENT_BRANCH" ]] && git branch -D $TEMP_BRANCH | 439 [[ "$TEMP_BRANCH" != "$CURRENT_BRANCH" ]] && git branch -D $TEMP_BRANCH |
421 [[ "$BRANCHNAME" != "$CURRENT_BRANCH" ]] && git branch -D $BRANCHNAME | 440 [[ "$BRANCHNAME" != "$CURRENT_BRANCH" ]] && git branch -D $BRANCHNAME |
422 [[ "$TRUNKBRANCH" != "$CURRENT_BRANCH" ]] && git branch -D $TRUNKBRANCH | 441 [[ "$TRUNKBRANCH" != "$CURRENT_BRANCH" ]] && git branch -D $TRUNKBRANCH |
423 fi | 442 fi |
424 | 443 |
425 if [ $STEP -le 20 ] ; then | 444 if [ $STEP -le 20 ] ; then |
426 echo ">>> Step 20: Done!" | 445 echo ">>> Step 20: Done!" |
427 restore_if_unset "MAJOR" | 446 restore_if_unset "MAJOR" |
428 restore_if_unset "MINOR" | 447 restore_if_unset "MINOR" |
429 restore_if_unset "BUILD" | 448 restore_if_unset "BUILD" |
430 echo "Congratulations, you have successfully created the trunk revision \ | 449 echo "Congratulations, you have successfully created the trunk revision \ |
431 $MAJOR.$MINOR.$BUILD. Please don't forget to update the v8rel spreadsheet, \ | 450 $MAJOR.$MINOR.$BUILD. Please don't forget to roll this new version into \ |
432 and to roll this new version into Chromium." | 451 Chromium, and to update the v8rel spreadsheet:" |
| 452 TRUNK_REVISION=$(cat "$TRUNK_REVISION_FILE") |
| 453 echo "$MAJOR.$MINOR.$BUILD\ttrunk\t$TRUNK_REVISION" |
433 # Clean up all temporary files. | 454 # Clean up all temporary files. |
434 rm -f "$PERSISTFILE_BASENAME"* | 455 rm -f "$PERSISTFILE_BASENAME"* |
435 fi | 456 fi |
OLD | NEW |