Improve push-to-trunk.sh

1) Make sure that commits sneaking in before the "Prepare Push" CL is landed are included in the push.
2) Easy-to-copy output at the end.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9978 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e49d533b
...@@ -38,6 +38,7 @@ CHANGELOG_ENTRY_FILE="$PERSISTFILE_BASENAME-changelog-entry" ...@@ -38,6 +38,7 @@ CHANGELOG_ENTRY_FILE="$PERSISTFILE_BASENAME-changelog-entry"
PATCH_FILE="$PERSISTFILE_BASENAME-patch" PATCH_FILE="$PERSISTFILE_BASENAME-patch"
COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg" COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg"
TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files" TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files"
TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision"
STEP=0 STEP=0
...@@ -225,7 +226,13 @@ exit your EDITOR. " ...@@ -225,7 +226,13 @@ exit your EDITOR. "
$EDITOR "$CHANGELOG_ENTRY_FILE" $EDITOR "$CHANGELOG_ENTRY_FILE"
NEWCHANGELOG=$(mktemp) NEWCHANGELOG=$(mktemp)
# Eliminate any trailing newlines by going through a shell variable. # Eliminate any trailing newlines by going through a shell variable.
CHANGELOGENTRY=$(cat "$CHANGELOG_ENTRY_FILE") # Also (1) eliminate tabs, (2) fix too little and (3) too much indentation,
# and (4) eliminate trailing whitespace.
CHANGELOGENTRY=$(cat "$CHANGELOG_ENTRY_FILE" \
| sed -e 's/\t/ /g' \
| sed -e 's/^ \{1,7\}\([^ ]\)/ \1/g' \
| sed -e 's/^ \{9,80\}\([^ ]\)/ \1/g' \
| sed -e 's/ \+$//')
[[ -n "$CHANGELOGENTRY" ]] || die "Empty ChangeLog entry." [[ -n "$CHANGELOGENTRY" ]] || die "Empty ChangeLog entry."
echo "$CHANGELOGENTRY" > "$NEWCHANGELOG" echo "$CHANGELOGENTRY" > "$NEWCHANGELOG"
echo "" >> "$NEWCHANGELOG" # Explicitly insert two empty lines. echo "" >> "$NEWCHANGELOG" # Explicitly insert two empty lines.
...@@ -260,8 +267,10 @@ if [ $STEP -le 7 ] ; then ...@@ -260,8 +267,10 @@ if [ $STEP -le 7 ] ; then
restore_if_unset "NEWMAJOR" restore_if_unset "NEWMAJOR"
restore_if_unset "NEWMINOR" restore_if_unset "NEWMINOR"
restore_if_unset "NEWBUILD" restore_if_unset "NEWBUILD"
git commit -a -m "Prepare push to trunk. \ PREPARE_COMMIT_MSG="Prepare push to trunk. \
Now working on version $NEWMAJOR.$NEWMINOR.$NEWBUILD." \ Now working on version $NEWMAJOR.$NEWMINOR.$NEWBUILD."
persist "PREPARE_COMMIT_MSG"
git commit -a -m $PREPARE_COMMIT_MSG \
|| die "'git commit -a' failed." || die "'git commit -a' failed."
fi fi
...@@ -276,7 +285,8 @@ fi ...@@ -276,7 +285,8 @@ fi
if [ $STEP -le 9 ] ; then if [ $STEP -le 9 ] ; then
echo ">>> Step 9: Commit to the repository." echo ">>> Step 9: Commit to the repository."
echo "Please wait for an LGTM, then type \"LGTM<Return>\" to commit your \ echo "Please wait for an LGTM, then type \"LGTM<Return>\" to commit your \
change. (If you need to iterate on the patch, do so in another shell.)" change. (If you need to iterate on the patch, do so in another shell. Do not \
modify the existing local commit's commit message.)"
unset ANSWER unset ANSWER
while [ "$ANSWER" != "LGTM" ] ; do while [ "$ANSWER" != "LGTM" ] ; do
[[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'."
...@@ -298,15 +308,21 @@ change. (If you need to iterate on the patch, do so in another shell.)" ...@@ -298,15 +308,21 @@ change. (If you need to iterate on the patch, do so in another shell.)"
fi fi
if [ $STEP -le 10 ] ; then if [ $STEP -le 10 ] ; then
echo ">>> Step 10: NOP" echo ">>> Step 10: Fetch straggler commits that sneaked in between \
# Present in the manual guide, not necessary (even harmful!) for this script. steps 1 and 9."
git svn fetch || die "'git svn fetch' failed."
git checkout svn/bleeding_edge
restore_if_unset "PREPARE_COMMIT_MSG"
PREPARE_COMMIT_HASH=$(git log -1 --format=%H --grep="$PREPARE_COMMIT_MSG")
persist "PREPARE_COMMIT_HASH"
fi fi
if [ $STEP -le 11 ] ; then if [ $STEP -le 11 ] ; then
echo ">>> Step 11: Squash commits into one." echo ">>> Step 11: Squash commits into one."
# Instead of relying on "git rebase -i", we'll just create a diff, because # Instead of relying on "git rebase -i", we'll just create a diff, because
# that's easier to automate. # that's easier to automate.
git diff svn/trunk > "$PATCH_FILE" restore_if_unset "PREPARE_COMMIT_HASH"
git diff svn/trunk $PREPARE_COMMIT_HASH > "$PATCH_FILE"
# Convert the ChangeLog entry to commit message format: # Convert the ChangeLog entry to commit message format:
# - remove date # - remove date
# - remove indentation # - remove indentation
...@@ -401,7 +417,10 @@ fi ...@@ -401,7 +417,10 @@ fi
if [ $STEP -le 17 ] ; then if [ $STEP -le 17 ] ; then
echo ">>> Step 17. Commit to SVN." echo ">>> Step 17. Commit to SVN."
git svn dcommit || die "'git svn dcommit' failed." git svn dcommit | tee >(grep -E "^Committed r[0-9]+" \
| sed -e 's/^Committed r\([0-9]\+\)/\1/' \
> "$TRUNK_REVISION_FILE") \
|| die "'git svn dcommit' failed."
fi fi
if [ $STEP -le 18 ] ; then if [ $STEP -le 18 ] ; then
...@@ -428,8 +447,10 @@ if [ $STEP -le 20 ] ; then ...@@ -428,8 +447,10 @@ if [ $STEP -le 20 ] ; then
restore_if_unset "MINOR" restore_if_unset "MINOR"
restore_if_unset "BUILD" restore_if_unset "BUILD"
echo "Congratulations, you have successfully created the trunk revision \ echo "Congratulations, you have successfully created the trunk revision \
$MAJOR.$MINOR.$BUILD. Please don't forget to update the v8rel spreadsheet, \ $MAJOR.$MINOR.$BUILD. Please don't forget to roll this new version into \
and to roll this new version into Chromium." Chromium, and to update the v8rel spreadsheet:"
TRUNK_REVISION=$(cat "$TRUNK_REVISION_FILE")
echo "$MAJOR.$MINOR.$BUILD\ttrunk\t$TRUNK_REVISION"
# Clean up all temporary files. # Clean up all temporary files.
rm -f "$PERSISTFILE_BASENAME"* rm -f "$PERSISTFILE_BASENAME"*
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