From: machenbach@chromium.org Date: Thu, 3 Apr 2014 09:42:18 +0000 (+0000) Subject: Add version number to commit message in merge-to-branch. X-Git-Tag: upstream/4.7.83~9849 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18308b389cc58e6e38b80136dcd33a9a56529e30;p=platform%2Fupstream%2Fv8.git Add version number to commit message in merge-to-branch. This is a step towards automatically rolling arbitrary trunk revisions into Chromium. This also deprecates the bash scripts as they now start to divert. BUG= R=jarin@chromium.org Review URL: https://codereview.chromium.org/223093003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20465 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/tools/common-includes.sh b/tools/common-includes.sh deleted file mode 100644 index 7785e9f..0000000 --- a/tools/common-includes.sh +++ /dev/null @@ -1,198 +0,0 @@ -# Copyright 2012 the V8 project authors. All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# This file contains common function definitions for various other shell -# scripts in this directory. It is not meant to be executed by itself. - -# Important: before including this file, the following variables must be set: -# - BRANCHNAME -# - PERSISTFILE_BASENAME - -TEMP_BRANCH=$BRANCHNAME-temporary-branch-created-by-script -VERSION_FILE="src/version.cc" -CHANGELOG_ENTRY_FILE="$PERSISTFILE_BASENAME-changelog-entry" -PATCH_FILE="$PERSISTFILE_BASENAME-patch" -COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg" -TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision" -START_STEP=0 -CURRENT_STEP=0 - -die() { - [[ -n "$1" ]] && echo "Error: $1" - echo "Exiting." - exit 1 -} - -confirm() { - echo -n "$1 [Y/n] " - read ANSWER - if [[ -z "$ANSWER" || "$ANSWER" == "Y" || "$ANSWER" == "y" ]] ; then - return 0 - else - return 1 - fi -} - -delete_branch() { - local MATCH=$(git branch | grep "$1" | awk '{print $NF}' | grep -x $1) - if [ "$MATCH" == "$1" ] ; then - confirm "Branch $1 exists, do you want to delete it?" - if [ $? -eq 0 ] ; then - git branch -D $1 || die "Deleting branch '$1' failed." - echo "Branch $1 deleted." - else - die "Can't continue. Please delete branch $1 and try again." - fi - fi -} - -# Persist and restore variables to support canceling/resuming execution -# of this script. -persist() { - local VARNAME=$1 - local FILE="$PERSISTFILE_BASENAME-$VARNAME" - local VALUE="${!VARNAME}" - if [ -z "$VALUE" ] ; then - VALUE="__EMPTY__" - fi - echo "$VALUE" > $FILE -} - -restore() { - local VARNAME=$1 - local FILE="$PERSISTFILE_BASENAME-$VARNAME" - local VALUE="$(cat $FILE)" - [[ -z "$VALUE" ]] && die "Variable '$VARNAME' could not be restored." - if [ "$VALUE" == "__EMPTY__" ] ; then - VALUE="" - fi - eval "$VARNAME=\"$VALUE\"" -} - -restore_if_unset() { - local VARNAME=$1 - [[ -z "${!VARNAME}" ]] && restore "$VARNAME" -} - -initial_environment_checks() { - # Cancel if this is not a git checkout. - [[ -d .git ]] \ - || die "This is not a git checkout, this script won't work for you." - - # Cancel if EDITOR is unset or not executable. - [[ -n "$EDITOR" && -x "$(which $EDITOR)" ]] \ - || die "Please set your EDITOR environment variable, you'll need it." -} - -common_prepare() { - # Check for a clean workdir. - [[ -z "$(git status -s -uno)" ]] \ - || die "Workspace is not clean. Please commit or undo your changes." - - # Persist current branch. - CURRENT_BRANCH=$(git status -s -b -uno | grep "^##" | awk '{print $2}') - persist "CURRENT_BRANCH" - - # Fetch unfetched revisions. - git svn fetch || die "'git svn fetch' failed." - - # Get ahold of a safe temporary branch and check it out. - if [ "$CURRENT_BRANCH" != "$TEMP_BRANCH" ] ; then - delete_branch $TEMP_BRANCH - git checkout -b $TEMP_BRANCH - fi - - # Delete the branch that will be created later if it exists already. - delete_branch $BRANCHNAME -} - -common_cleanup() { - restore_if_unset "CURRENT_BRANCH" - git checkout -f $CURRENT_BRANCH - [[ "$TEMP_BRANCH" != "$CURRENT_BRANCH" ]] && git branch -D $TEMP_BRANCH - [[ "$BRANCHNAME" != "$CURRENT_BRANCH" ]] && git branch -D $BRANCHNAME - # Clean up all temporary files. - rm -f "$PERSISTFILE_BASENAME"* -} - -# These two functions take a prefix for the variable names as first argument. -read_and_persist_version() { - for v in MAJOR_VERSION MINOR_VERSION BUILD_NUMBER PATCH_LEVEL; do - VARNAME="$1${v%%_*}" - VALUE=$(grep "#define $v" "$VERSION_FILE" | awk '{print $NF}') - eval "$VARNAME=\"$VALUE\"" - persist "$VARNAME" - done -} -restore_version_if_unset() { - for v in MAJOR MINOR BUILD PATCH; do - restore_if_unset "$1$v" - done -} - -upload_step() { - let CURRENT_STEP+=1 - if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Upload for code review." - echo -n "Please enter the email address of a V8 reviewer for your patch: " - read REVIEWER - git cl upload -r "$REVIEWER" --send-mail \ - || die "'git cl upload' failed, please try again." - fi -} - -wait_for_lgtm() { - echo "Please wait for an LGTM, then type \"LGTM\" to commit your \ -change. (If you need to iterate on the patch or double check that it's \ -sane, do so in another shell, but remember to not change the headline of \ -the uploaded CL." - unset ANSWER - while [ "$ANSWER" != "LGTM" ] ; do - [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." - echo -n "> " - read ANSWER - done -} - -wait_for_resolving_conflicts() { - echo "Applying the patch \"$1\" failed. Either type \"ABORT\", or \ -resolve the conflicts, stage *all* touched files with 'git add', and \ -type \"RESOLVED\"" - unset ANSWER - while [ "$ANSWER" != "RESOLVED" ] ; do - [[ "$ANSWER" == "ABORT" ]] && die "Applying the patch failed." - [[ -n "$ANSWER" ]] && echo "That was not 'RESOLVED' or 'ABORT'." - echo -n "> " - read ANSWER - done -} - -# Takes a file containing the patch to apply as first argument. -apply_patch() { - git apply --index --reject $REVERSE_PATCH "$1" || \ - wait_for_resolving_conflicts "$1"; -} diff --git a/tools/merge-to-branch.sh b/tools/merge-to-branch.sh deleted file mode 100755 index 4e8a86c..0000000 --- a/tools/merge-to-branch.sh +++ /dev/null @@ -1,342 +0,0 @@ -#!/bin/bash -# Copyright 2012 the V8 project authors. All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -########## Global variable definitions - -BRANCHNAME=prepare-merge -PERSISTFILE_BASENAME=/tmp/v8-merge-to-branch-tempfile -ALREADY_MERGING_SENTINEL_FILE="$PERSISTFILE_BASENAME-already-merging" -COMMIT_HASHES_FILE="$PERSISTFILE_BASENAME-PATCH_COMMIT_HASHES" -TEMPORARY_PATCH_FILE="$PERSISTFILE_BASENAME-temporary-patch" - -########## Function definitions - -source $(dirname $BASH_SOURCE)/common-includes.sh - -usage() { -cat << EOF -usage: $0 [OPTIONS]... [BRANCH] [REVISION]... - -Performs the necessary steps to merge revisions from bleeding_edge -to other branches, including trunk. - -OPTIONS: - -h Show this message - -s Specify the step where to start work. Default: 0. - -p Specify a patch file to apply as part of the merge - -m Specify a commit message for the patch - -r Reverse specified patches -EOF -} - -persist_patch_commit_hashes() { - echo "PATCH_COMMIT_HASHES=( ${PATCH_COMMIT_HASHES[@]} )" > $COMMIT_HASHES_FILE -} - -restore_patch_commit_hashes() { - source $COMMIT_HASHES_FILE -} - -restore_patch_commit_hashes_if_unset() { - [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && restore_patch_commit_hashes - [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && [[ -z "$EXTRA_PATCH" ]] && \ - die "Variable PATCH_COMMIT_HASHES could not be restored." -} - -########## Option parsing -REVERT_FROM_BLEEDING_EDGE=0 - -while getopts ":hs:fp:rm:R" OPTION ; do - case $OPTION in - h) usage - exit 0 - ;; - p) EXTRA_PATCH=$OPTARG - ;; - f) rm -f "$ALREADY_MERGING_SENTINEL_FILE" - ;; - r) REVERSE_PATCH="--reverse" - ;; - m) NEW_COMMIT_MSG=$OPTARG - ;; - s) START_STEP=$OPTARG - ;; - R) REVERSE_PATCH="--reverse" - REVERT_FROM_BLEEDING_EDGE=1 - ;; - ?) echo "Illegal option: -$OPTARG" - usage - exit 1 - ;; - esac -done -let OPTION_COUNT=$OPTIND-1 -shift $OPTION_COUNT - -########## Regular workflow - -# If there is a merge in progress, abort. -[[ -e "$ALREADY_MERGING_SENTINEL_FILE" ]] && [[ $START_STEP -eq 0 ]] \ - && die "A merge is already in progress" -touch "$ALREADY_MERGING_SENTINEL_FILE" - -initial_environment_checks - -if [ $START_STEP -le $CURRENT_STEP ] ; then - let MIN_EXPECTED_ARGS=2-$REVERT_FROM_BLEEDING_EDGE - if [ ${#@} -lt $MIN_EXPECTED_ARGS ] ; then - if [ -z "$EXTRA_PATCH" ] ; then - die "Either a patch file or revision numbers must be specified" - fi - if [ -z "$NEW_COMMIT_MSG" ] ; then - die "You must specify a merge comment if no patches are specified" - fi - fi - echo ">>> Step $CURRENT_STEP: Preparation" - if [ $REVERT_FROM_BLEEDING_EDGE -eq 1 ] ; then - MERGE_TO_BRANCH="bleeding_edge" - else - MERGE_TO_BRANCH=$1 - [[ -n "$MERGE_TO_BRANCH" ]] || die "Please specify a branch to merge to" - shift - fi - persist "MERGE_TO_BRANCH" - common_prepare -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Create a fresh branch for the patch." - restore_if_unset "MERGE_TO_BRANCH" - git checkout -b $BRANCHNAME svn/$MERGE_TO_BRANCH \ - || die "Creating branch $BRANCHNAME failed." -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Search for corresponding architecture ports." - for REVISION in "$@" ; do - # Add the revision to the array if it isn't already added. - if [[ ! "${FULL_REVISION_LIST[@]}" =~ (^| )$REVISION($| ) ]] ; then - FULL_REVISION_LIST=("${FULL_REVISION_LIST[@]}" "$REVISION") - fi - # Search for commits which matches the "Port rXXX" pattern. - GIT_HASHES=$(git log svn/bleeding_edge --reverse \ - --format=%H --grep="Port r$REVISION") - if [ -n "$GIT_HASHES" ]; then - while read -r NEXT_GIT_HASH; do - NEXT_SVN_REVISION=$(git svn find-rev $NEXT_GIT_HASH svn/bleeding_edge) - [[ -n "$NEXT_SVN_REVISION" ]] \ - || die "Cannot determine svn revision for $NEXT_GIT_HASH" - FULL_REVISION_LIST=("${FULL_REVISION_LIST[@]}" "$NEXT_SVN_REVISION") - REVISION_TITLE=$(git log -1 --format=%s $NEXT_GIT_HASH) - # Is this revision included in the original revision list? - if [[ $@ =~ (^| )$NEXT_SVN_REVISION($| ) ]] ; then - echo "Found port of r$REVISION -> \ -r$NEXT_SVN_REVISION (already included): $REVISION_TITLE" - else - echo "Found port of r$REVISION -> \ -r$NEXT_SVN_REVISION: $REVISION_TITLE" - PORT_REVISION_LIST=("${PORT_REVISION_LIST[@]}" "$NEXT_SVN_REVISION") - fi - done <<< "$GIT_HASHES" - fi - done - # Next step expects a list, not an array. - FULL_REVISION_LIST="${FULL_REVISION_LIST[@]}" - # Do we find any port? - if [ ${#PORT_REVISION_LIST[@]} -ne 0 ] ; then - confirm "Automatically add corresponding ports (${PORT_REVISION_LIST[*]})?" - #: 'n': Restore the original revision list. - if [ $? -ne 0 ] ; then - FULL_REVISION_LIST="$@" - fi - fi - persist "FULL_REVISION_LIST" -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Find the git \ -revisions associated with the patches." - restore_if_unset "FULL_REVISION_LIST" - current=0 - for REVISION in $FULL_REVISION_LIST ; do - NEXT_HASH=$(git svn find-rev "r$REVISION" svn/bleeding_edge) - [[ -n "$NEXT_HASH" ]] \ - || die "Cannot determine git hash for r$REVISION" - PATCH_COMMIT_HASHES[$current]="$NEXT_HASH" - [[ -n "$REVISION_LIST" ]] && REVISION_LIST="$REVISION_LIST," - REVISION_LIST="$REVISION_LIST r$REVISION" - let current+=1 - done - if [ -n "$REVISION_LIST" ] ; then - if [ -n "$REVERSE_PATCH" ] ; then - if [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then - NEW_COMMIT_MSG="Rollback of$REVISION_LIST in $MERGE_TO_BRANCH branch." - else - NEW_COMMIT_MSG="Revert$REVISION_LIST." - fi - else - NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch." - fi; - fi; - - echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE - echo "" >> $COMMITMSG_FILE - for HASH in ${PATCH_COMMIT_HASHES[@]} ; do - PATCH_MERGE_DESCRIPTION=$(git log -1 --format=%s $HASH) - echo "$PATCH_MERGE_DESCRIPTION" >> $COMMITMSG_FILE - echo "" >> $COMMITMSG_FILE - done - for HASH in ${PATCH_COMMIT_HASHES[@]} ; do - BUG=$(git log -1 $HASH | grep "BUG=" | awk -F '=' '{print $NF}') - if [ -n "$BUG" ] ; then - [[ -n "$BUG_AGGREGATE" ]] && BUG_AGGREGATE="$BUG_AGGREGATE," - BUG_AGGREGATE="$BUG_AGGREGATE$BUG" - fi - done - if [ -n "$BUG_AGGREGATE" ] ; then - echo "BUG=$BUG_AGGREGATE" >> $COMMITMSG_FILE - echo "LOG=N" >> $COMMITMSG_FILE - fi - persist "NEW_COMMIT_MSG" - persist "REVISION_LIST" - persist_patch_commit_hashes -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Apply patches for selected revisions." - restore_if_unset "MERGE_TO_BRANCH" - restore_patch_commit_hashes_if_unset "PATCH_COMMIT_HASHES" - for HASH in ${PATCH_COMMIT_HASHES[@]} ; do - echo "Applying patch for $HASH to $MERGE_TO_BRANCH..." - git log -1 -p $HASH > "$TEMPORARY_PATCH_FILE" - apply_patch "$TEMPORARY_PATCH_FILE" - done - if [ -n "$EXTRA_PATCH" ] ; then - apply_patch "$EXTRA_PATCH" - fi -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then - echo ">>> Step $CURRENT_STEP: Prepare $VERSION_FILE." - # These version numbers are used again for creating the tag - read_and_persist_version -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then - echo ">>> Step $CURRENT_STEP: Increment version number." - restore_if_unset "PATCH" - NEWPATCH=$(($PATCH + 1)) - confirm "Automatically increment PATCH_LEVEL? (Saying 'n' will fire up \ -your EDITOR on $VERSION_FILE so you can make arbitrary changes. When \ -you're done, save the file and exit your EDITOR.)" - if [ $? -eq 0 ] ; then - echo $NEWPATCH $VERSION_FILE - sed -e "/#define PATCH_LEVEL/s/[0-9]*$/$NEWPATCH/" \ - -i.bak "$VERSION_FILE" || die "Could not increment patch level" - else - $EDITOR "$VERSION_FILE" - fi - read_and_persist_version "NEW" -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Commit to local branch." - git commit -a -F "$COMMITMSG_FILE" \ - || die "'git commit -a' failed." -fi - -upload_step - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Commit to the repository." - restore_if_unset "MERGE_TO_BRANCH" - git checkout $BRANCHNAME \ - || die "cannot ensure that the current branch is $BRANCHNAME" - wait_for_lgtm - PRESUBMIT_TREE_CHECK="skip" git cl presubmit \ - || die "presubmit failed" - PRESUBMIT_TREE_CHECK="skip" git cl dcommit --bypass-hooks \ - || die "failed to commit to $MERGE_TO_BRANCH" -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then - echo ">>> Step $CURRENT_STEP: Determine svn commit revision" - restore_if_unset "NEW_COMMIT_MSG" - restore_if_unset "MERGE_TO_BRANCH" - git svn fetch || die "'git svn fetch' failed." - COMMIT_HASH=$(git log -1 --format=%H --grep="$NEW_COMMIT_MSG" \ - svn/$MERGE_TO_BRANCH) - [[ -z "$COMMIT_HASH" ]] && die "Unable to map git commit to svn revision" - SVN_REVISION=$(git svn find-rev $COMMIT_HASH) - echo "subversion revision number is r$SVN_REVISION" - persist "SVN_REVISION" -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then - echo ">>> Step $CURRENT_STEP: Create the tag." - restore_if_unset "SVN_REVISION" - restore_version_if_unset "NEW" - echo "Creating tag svn/tags/$NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" - if [ "$MERGE_TO_BRANCH" == "trunk" ] ; then - TO_URL="$MERGE_TO_BRANCH" - else - TO_URL="branches/$MERGE_TO_BRANCH" - fi - svn copy -r $SVN_REVISION \ - https://v8.googlecode.com/svn/$TO_URL \ - https://v8.googlecode.com/svn/tags/$NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH \ - -m "Tagging version $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" - persist "TO_URL" -fi - -let CURRENT_STEP+=1 -if [ $START_STEP -le $CURRENT_STEP ] ; then - echo ">>> Step $CURRENT_STEP: Cleanup." - restore_if_unset "SVN_REVISION" - restore_if_unset "TO_URL" - restore_if_unset "REVISION_LIST" - restore_version_if_unset "NEW" - common_cleanup - if [ $REVERT_FROM_BLEEDING_EDGE==0 ] ; then - echo "*** SUMMARY ***" - echo "version: $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" - echo "branch: $TO_URL" - echo "svn revision: $SVN_REVISION" - [[ -n "$REVISION_LIST" ]] && echo "patches:$REVISION_LIST" - fi -fi diff --git a/tools/push-to-trunk/merge_to_branch.py b/tools/push-to-trunk/merge_to_branch.py index f0acd14..87ba02b 100755 --- a/tools/push-to-trunk/merge_to_branch.py +++ b/tools/push-to-trunk/merge_to_branch.py @@ -158,7 +158,6 @@ class FindGitRevisions(Step): bug_aggregate = ",".join(sorted(bugs)) if bug_aggregate: self["new_commit_msg"] += "BUG=%s\nLOG=N\n" % bug_aggregate - TextToFile(self["new_commit_msg"], self.Config(COMMITMSG_FILE)) class ApplyPatches(Step): @@ -181,7 +180,7 @@ class PrepareVersion(Step): def RunStep(self): if self._options.revert_bleeding_edge: return - # These version numbers are used again for creating the tag + # This is used to calculate the patch level increment. self.ReadAndPersistVersion() @@ -204,12 +203,20 @@ class IncrementVersion(Step): else: self.Editor(self.Config(VERSION_FILE)) self.ReadAndPersistVersion("new_") + self["version"] = "%s.%s.%s.%s" % (self["new_major"], + self["new_minor"], + self["new_build"], + self["new_patch"]) class CommitLocal(Step): MESSAGE = "Commit to local branch." def RunStep(self): + if not self._options.revert_bleeding_edge: + self["new_commit_msg"] = "Version %s\n\n%s" % (self["version"], + self["new_commit_msg"]) + TextToFile(self["new_commit_msg"], self.Config(COMMITMSG_FILE)) self.GitCommit(file_name=self.Config(COMMITMSG_FILE)) @@ -244,10 +251,6 @@ class TagRevision(Step): def RunStep(self): if self._options.revert_bleeding_edge: return - self["version"] = "%s.%s.%s.%s" % (self["new_major"], - self["new_minor"], - self["new_build"], - self["new_patch"]) print "Creating tag svn/tags/%s" % self["version"] if self["merge_to_branch"] == "trunk": self["to_url"] = "trunk" diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py index f1fe46f..0e70afd 100644 --- a/tools/push-to-trunk/test_scripts.py +++ b/tools/push-to-trunk/test_scripts.py @@ -985,7 +985,9 @@ deps = { return lambda: self.assertEquals(patch, FileToText(TEST_CONFIG[TEMPORARY_PATCH_FILE])) - msg = """Merged r12345, r23456, r34567, r45678, r56789 into trunk branch. + msg = """Version 3.22.5.1 + +Merged r12345, r23456, r34567, r45678, r56789 into trunk branch. Title4