OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2012 the V8 project authors. All rights reserved. | 2 # Copyright 2012 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 11 matching lines...) Expand all Loading... |
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 ########## Global variable definitions | 29 ########## Global variable definitions |
30 | 30 |
31 BRANCHNAME=prepare-merge | 31 BRANCHNAME=prepare-merge |
32 VERSION_FILE="src/version.cc" | |
33 PERSISTFILE_BASENAME=/tmp/v8-merge-to-branch-tempfile | 32 PERSISTFILE_BASENAME=/tmp/v8-merge-to-branch-tempfile |
34 ALREADY_MERGING_SENTINEL_FILE="$PERSISTFILE_BASENAME-already-merging" | 33 ALREADY_MERGING_SENTINEL_FILE="$PERSISTFILE_BASENAME-already-merging" |
35 CHANGELOG_ENTRY_FILE="$PERSISTFILE_BASENAME-changelog-entry" | 34 COMMIT_HASHES_FILE="$PERSISTFILE_BASENAME-PATCH_COMMIT_HASHES" |
36 PATCH_FILE="$PERSISTFILE_BASENAME-patch" | 35 TEMPORARY_PATCH_FILE="$PERSISTFILE_BASENAME-temporary-patch" |
37 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg" | 36 |
38 COMMITMSG_FILE_COPY="$PERSISTFILE_BASENAME-commitmsg-copy" | 37 ########## Function definitions |
39 TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files" | 38 |
40 TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision" | 39 source $(dirname $BASH_SOURCE)/common-includes.sh |
41 START_STEP=0 | |
42 CURRENT_STEP=0 | |
43 | 40 |
44 usage() { | 41 usage() { |
45 cat << EOF | 42 cat << EOF |
46 usage: $0 [OPTIONS]... [BRANCH] [REVISION]... | 43 usage: $0 [OPTIONS]... [BRANCH] [REVISION]... |
47 | 44 |
48 Performs the necessary steps to merge revisions from bleeding_edge | 45 Performs the necessary steps to merge revisions from bleeding_edge |
49 to other branches, including trunk. | 46 to other branches, including trunk. |
50 | 47 |
51 OPTIONS: | 48 OPTIONS: |
52 -h Show this message | 49 -h Show this message |
53 -s Specify the step where to start work. Default: 0. | 50 -s Specify the step where to start work. Default: 0. |
54 EOF | 51 EOF |
55 } | 52 } |
56 | 53 |
57 ########## Function definitions | |
58 | |
59 die() { | |
60 [[ -n "$1" ]] && echo "Error: $1" | |
61 echo "Exiting." | |
62 exit 1 | |
63 } | |
64 | |
65 confirm() { | |
66 echo -n "$1 [Y/n] " | |
67 read ANSWER | |
68 if [[ -z "$ANSWER" || "$ANSWER" == "Y" || "$ANSWER" == "y" ]] ; then | |
69 return 0 | |
70 else | |
71 return 1 | |
72 fi | |
73 } | |
74 | |
75 delete_branch() { | |
76 local MATCH=$(git branch | grep $1 | awk '{print $NF}' ) | |
77 if [ "$MATCH" == "$1" ] ; then | |
78 confirm "Branch $1 exists, do you want to delete it?" | |
79 if [ $? -eq 0 ] ; then | |
80 git branch -D $1 || die "Deleting branch '$1' failed." | |
81 echo "Branch $1 deleted." | |
82 else | |
83 die "Can't continue. Please delete branch $1 and try again." | |
84 fi | |
85 fi | |
86 } | |
87 | |
88 # Persist and restore variables to support canceling/resuming execution | |
89 # of this script. | |
90 persist() { | |
91 local VARNAME=$1 | |
92 local FILE="$PERSISTFILE_BASENAME-$VARNAME" | |
93 echo "${!VARNAME}" > $FILE | |
94 } | |
95 | |
96 restore() { | |
97 local VARNAME=$1 | |
98 local FILE="$PERSISTFILE_BASENAME-$VARNAME" | |
99 local VALUE="$(cat $FILE)" | |
100 eval "$VARNAME=\"$VALUE\"" | |
101 } | |
102 | |
103 restore_if_unset() { | |
104 local VARNAME=$1 | |
105 [[ -z "${!VARNAME}" ]] && restore "$VARNAME" | |
106 [[ -z "${!VARNAME}" ]] && die "Variable '$VARNAME' could not be restored." | |
107 } | |
108 | |
109 persist_patch_commit_hashes() { | 54 persist_patch_commit_hashes() { |
110 local FILE="$PERSISTFILE_BASENAME-PATCH_COMMIT_HASHES" | 55 echo "PATCH_COMMIT_HASHES=( ${PATCH_COMMIT_HASHES[@]} )" > $COMMIT_HASHES_FILE |
111 echo "PATCH_COMMIT_HASHES=( ${PATCH_COMMIT_HASHES[@]} )" > $FILE | |
112 } | 56 } |
113 | 57 |
114 restore_patch_commit_hashes() { | 58 restore_patch_commit_hashes() { |
115 local FILE="$PERSISTFILE_BASENAME-PATCH_COMMIT_HASHES" | 59 source $COMMIT_HASHES_FILE |
116 source $FILE | |
117 } | 60 } |
118 | 61 |
119 restore_patch_commit_hashes_if_unset() { | 62 restore_patch_commit_hashes_if_unset() { |
120 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && restore_patch_commit_hashes | 63 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && restore_patch_commit_hashes |
121 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && \ | 64 [[ "${#PATCH_COMMIT_HASHES[@]}" == 0 ]] && \ |
122 die "Variable PATCH_COMMIT_HASHES could not be restored." | 65 die "Variable PATCH_COMMIT_HASHES could not be restored." |
123 } | 66 } |
124 | 67 |
125 ########## Option parsing | 68 ########## Option parsing |
126 | 69 |
(...skipping 15 matching lines...) Expand all Loading... |
142 let OPTION_COUNT=$OPTIND-1 | 85 let OPTION_COUNT=$OPTIND-1 |
143 shift $OPTION_COUNT | 86 shift $OPTION_COUNT |
144 | 87 |
145 ########## Regular workflow | 88 ########## Regular workflow |
146 | 89 |
147 # If there is a merge in progress, abort. | 90 # If there is a merge in progress, abort. |
148 [[ -e "$ALREADY_MERGING_SENTINEL_FILE" ]] && [[ -z "$START_STEP" ]] \ | 91 [[ -e "$ALREADY_MERGING_SENTINEL_FILE" ]] && [[ -z "$START_STEP" ]] \ |
149 && die "A merge is already in progress" | 92 && die "A merge is already in progress" |
150 touch "$ALREADY_MERGING_SENTINEL_FILE" | 93 touch "$ALREADY_MERGING_SENTINEL_FILE" |
151 | 94 |
152 # Cancel if this is not a git checkout. | 95 initial_environment_checks |
153 [[ -d .git ]] \ | |
154 || die "This is not a git checkout, this script won't work for you." | |
155 | |
156 # Cancel if EDITOR is unset or not executable. | |
157 [[ -n "$EDITOR" && -x "$(which $EDITOR)" ]] \ | |
158 || die "Please set your EDITOR environment variable, you'll need it." | |
159 | 96 |
160 if [ $START_STEP -le $CURRENT_STEP ] ; then | 97 if [ $START_STEP -le $CURRENT_STEP ] ; then |
| 98 echo ">>> Step $CURRENT_STEP: Preparation" |
161 MERGE_TO_BRANCH=$1 | 99 MERGE_TO_BRANCH=$1 |
162 [[ -n "$MERGE_TO_BRANCH" ]] \ | 100 [[ -n "$MERGE_TO_BRANCH" ]] || die "Please specify a branch to merge to" |
163 || die "Please specify a branch to merge to" | |
164 shift | 101 shift |
165 persist "MERGE_TO_BRANCH" | 102 persist "MERGE_TO_BRANCH" |
166 | 103 common_prepare |
167 echo ">>> Step $CURRENT_STEP: Preparation" | |
168 # Check for a clean workdir. | |
169 [[ -z "$(git status -s -uno)" ]] \ | |
170 || die "Workspace is not clean. Please commit or undo your changes." | |
171 | |
172 # Persist current branch. | |
173 CURRENT_BRANCH=$(git status -s -b -uno | grep "^##" | awk '{print $2}') | |
174 persist "CURRENT_BRANCH" | |
175 delete_branch $BRANCHNAME | |
176 fi | 104 fi |
177 | 105 |
178 let CURRENT_STEP+=1 | 106 let CURRENT_STEP+=1 |
179 if [ $START_STEP -le $CURRENT_STEP ] ; then | 107 if [ $START_STEP -le $CURRENT_STEP ] ; then |
180 echo ">>> Step $CURRENT_STEP: Fetch unfetched revisions." | 108 echo ">>> Step $CURRENT_STEP: Create a fresh branch for the patch." |
181 git svn fetch || die "'git svn fetch' failed." | |
182 fi | |
183 | |
184 let CURRENT_STEP+=1 | |
185 if [ $START_STEP -le $CURRENT_STEP ] ; then | |
186 restore_if_unset "MERGE_TO_BRANCH" | 109 restore_if_unset "MERGE_TO_BRANCH" |
187 echo ">>> Step $CURRENT_STEP: Create a fresh branch for the patch." | |
188 git checkout -b $BRANCHNAME svn/$MERGE_TO_BRANCH \ | 110 git checkout -b $BRANCHNAME svn/$MERGE_TO_BRANCH \ |
189 || die "Creating branch $BRANCHNAME failed." | 111 || die "Creating branch $BRANCHNAME failed." |
190 fi | 112 fi |
191 | 113 |
192 let CURRENT_STEP+=1 | 114 let CURRENT_STEP+=1 |
193 if [ $START_STEP -le $CURRENT_STEP ] ; then | 115 if [ $START_STEP -le $CURRENT_STEP ] ; then |
194 echo ">>> Step $CURRENT_STEP: Find the git \ | 116 echo ">>> Step $CURRENT_STEP: Find the git \ |
195 revisions associated with the patches." | 117 revisions associated with the patches." |
196 current=0 | 118 current=0 |
197 for REVISION in "$@" ; do | 119 for REVISION in "$@" ; do |
198 NEXT_HASH=$(git svn find-rev "r$REVISION" svn/bleeding_edge) | 120 NEXT_HASH=$(git svn find-rev "r$REVISION" svn/bleeding_edge) |
199 [[ -n "$NEXT_HASH" ]] \ | 121 [[ -n "$NEXT_HASH" ]] \ |
200 || die "Cannot determine git hash for r$REVISION" | 122 || die "Cannot determine git hash for r$REVISION" |
201 PATCH_COMMIT_HASHES[$current]="$NEXT_HASH" | 123 PATCH_COMMIT_HASHES[$current]="$NEXT_HASH" |
202 [[ -n "$NEW_COMMIT_MSG" ]] && NEW_COMMIT_MSG="$NEW_COMMIT_MSG," | 124 [[ -n "$NEW_COMMIT_MSG" ]] && NEW_COMMIT_MSG="$NEW_COMMIT_MSG," |
203 NEW_COMMIT_MSG="$NEW_COMMIT_MSG r$REVISION" | 125 NEW_COMMIT_MSG="$NEW_COMMIT_MSG r$REVISION" |
204 let current+=1 | 126 let current+=1 |
205 done | 127 done |
206 NEW_COMMIT_MSG="Merged$NEW_COMMIT_MSG into $MERGE_TO_BRANCH branch." | 128 NEW_COMMIT_MSG="Merged$NEW_COMMIT_MSG into $MERGE_TO_BRANCH branch." |
207 | 129 |
208 echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE | 130 echo "$NEW_COMMIT_MSG" > $COMMITMSG_FILE |
209 echo >> $COMMITMSG_FILE | 131 echo "" >> $COMMITMSG_FILE |
210 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do | 132 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do |
211 PATCH_MERGE_DESCRIPTION=$(git log -1 --format=%s $HASH) | 133 PATCH_MERGE_DESCRIPTION=$(git log -1 --format=%s $HASH) |
212 echo "$PATCH_MERGE_DESCRIPTION" >> $COMMITMSG_FILE | 134 echo "$PATCH_MERGE_DESCRIPTION" >> $COMMITMSG_FILE |
213 echo >> $COMMITMSG_FILE | 135 echo "" >> $COMMITMSG_FILE |
214 done | 136 done |
215 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do | 137 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do |
216 BUG=$(git log -1 $HASH | grep "BUG=" | awk -F '=' '{print $NF}') | 138 BUG=$(git log -1 $HASH | grep "BUG=" | awk -F '=' '{print $NF}') |
217 if [ $BUG ] ; then | 139 if [ -n "$BUG" ] ; then |
218 if [ "$BUG_AGGREGATE" ] ; then | 140 [[ -n "$BUG_AGGREGATE" ]] && BUG_AGGREGATE="$BUG_AGGREGATE," |
219 BUG_AGGREGATE="$BUG_AGGREGATE," | |
220 fi | |
221 BUG_AGGREGATE="$BUG_AGGREGATE$BUG" | 141 BUG_AGGREGATE="$BUG_AGGREGATE$BUG" |
222 fi | 142 fi |
223 done | 143 done |
224 if [ "$BUG_AGGREGATE" ] ; then | 144 if [ -n "$BUG_AGGREGATE" ] ; then |
225 echo "BUG=$BUG_AGGREGATE" >> $COMMITMSG_FILE | 145 echo "BUG=$BUG_AGGREGATE" >> $COMMITMSG_FILE |
226 fi | 146 fi |
227 persist "NEW_COMMIT_MSG" | 147 persist "NEW_COMMIT_MSG" |
228 persist_patch_commit_hashes | 148 persist_patch_commit_hashes |
229 fi | 149 fi |
230 | 150 |
231 let CURRENT_STEP+=1 | 151 let CURRENT_STEP+=1 |
232 if [ $START_STEP -le $CURRENT_STEP ] ; then | 152 if [ $START_STEP -le $CURRENT_STEP ] ; then |
| 153 echo ">>> Step $CURRENT_STEP: Apply patches for selected revisions." |
233 restore_if_unset "MERGE_TO_BRANCH" | 154 restore_if_unset "MERGE_TO_BRANCH" |
234 restore_patch_commit_hashes_if_unset "PATCH_COMMIT_HASHES" | 155 restore_patch_commit_hashes_if_unset "PATCH_COMMIT_HASHES" |
235 echo "${PATCH_COMMIT_HASHES[@]}" | |
236 echo ">>> Step $CURRENT_STEP: Apply patches for selected revisions." | |
237 rm -f "$TOUCHED_FILES_FILE" | 156 rm -f "$TOUCHED_FILES_FILE" |
238 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do | 157 for HASH in ${PATCH_COMMIT_HASHES[@]} ; do |
239 git log -1 -p $HASH | patch -p1 \ | 158 echo "Applying patch for $HASH to $MERGE_TO_BRANCH..." |
240 | tee >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE") | 159 git log -1 -p $HASH > "$TEMPORARY_PATCH_FILE" |
241 [[ $? -eq 0 ]] \ | 160 apply_patch "$TEMPORARY_PATCH_FILE" |
242 || die "Cannot apply the patch for $HASH to $MERGE_TO_BRANCH." | |
243 done | 161 done |
244 # Stage added and modified files. | 162 stage_files |
245 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE") | |
246 for FILE in $TOUCHED_FILES ; do | |
247 git add "$FILE" | |
248 done | |
249 # Stage deleted files. | |
250 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \ | |
251 | awk '{print $NF}') | |
252 for FILE in $DELETED_FILES ; do | |
253 git rm "$FILE" | |
254 done | |
255 rm -f "$TOUCHED_FILES_FILE" | |
256 fi | 163 fi |
257 | 164 |
258 let CURRENT_STEP+=1 | 165 let CURRENT_STEP+=1 |
259 if [ $START_STEP -le $CURRENT_STEP ] ; then | 166 if [ $START_STEP -le $CURRENT_STEP ] ; then |
260 echo ">>> Step $CURRENT_STEP: Prepare version.cc" | 167 echo ">>> Step $CURRENT_STEP: Prepare $VERSION_FILE." |
261 # These version numbers are used again for creating the tag | 168 # These version numbers are used again for creating the tag |
262 PATCH=$(grep "#define PATCH_LEVEL" "$VERSION_FILE" | awk '{print $NF}') | 169 read_and_persist_version |
263 persist "PATCH" | |
264 fi | 170 fi |
265 | 171 |
266 let CURRENT_STEP+=1 | 172 let CURRENT_STEP+=1 |
267 if [ $START_STEP -le $CURRENT_STEP ] ; then | 173 if [ $START_STEP -le $CURRENT_STEP ] ; then |
268 echo ">>> Step $CURRENT_STEP: Increment version number." | 174 echo ">>> Step $CURRENT_STEP: Increment version number." |
269 restore_if_unset "PATCH" | 175 restore_if_unset "PATCH" |
270 NEWPATCH=$(($PATCH + 1)) | 176 NEWPATCH=$(($PATCH + 1)) |
271 confirm "Automatically increment PATCH_LEVEL? (Saying 'n' will fire up \ | 177 confirm "Automatically increment PATCH_LEVEL? (Saying 'n' will fire up \ |
272 your EDITOR on $VERSION_FILE so you can make arbitrary changes. When \ | 178 your EDITOR on $VERSION_FILE so you can make arbitrary changes. When \ |
273 you're done, save the file and exit your EDITOR.)" | 179 you're done, save the file and exit your EDITOR.)" |
274 if [ $? -eq 0 ] ; then | 180 if [ $? -eq 0 ] ; then |
275 sed -e "/#define PATCH_LEVEL/s/[0-9]*$/$NEWPATCH/" \ | 181 sed -e "/#define PATCH_LEVEL/s/[0-9]*$/$NEWPATCH/" \ |
276 -i "$VERSION_FILE" | 182 -i "$VERSION_FILE" |
277 else | 183 else |
278 $EDITOR "$VERSION_FILE" | 184 $EDITOR "$VERSION_FILE" |
279 fi | 185 fi |
280 NEWMAJOR=$(grep "#define MAJOR_VERSION" "$VERSION_FILE" | awk '{print $NF}') | 186 read_and_persist_version "NEW" |
281 persist "NEWMAJOR" | |
282 NEWMINOR=$(grep "#define MINOR_VERSION" "$VERSION_FILE" | awk '{print $NF}') | |
283 persist "NEWMINOR" | |
284 NEWBUILD=$(grep "#define BUILD_NUMBER" "$VERSION_FILE" | awk '{print $NF}') | |
285 persist "NEWBUILD" | |
286 NEWPATCH=$(grep "#define PATCH_LEVEL" "$VERSION_FILE" | awk '{print $NF}') | |
287 persist "NEWPATCH" | |
288 fi | 187 fi |
289 | 188 |
290 let CURRENT_STEP+=1 | 189 let CURRENT_STEP+=1 |
291 if [ $START_STEP -le $CURRENT_STEP ] ; then | 190 if [ $START_STEP -le $CURRENT_STEP ] ; then |
292 echo ">>> Step $CURRENT_STEP: Commit to local branch." | 191 echo ">>> Step $CURRENT_STEP: Commit to local branch." |
293 git commit -a -F "$COMMITMSG_FILE" \ | 192 git commit -a -F "$COMMITMSG_FILE" \ |
294 || die "'git commit -a' failed." | 193 || die "'git commit -a' failed." |
295 fi | 194 fi |
296 | 195 |
297 let CURRENT_STEP+=1 | 196 upload_step |
298 if [ $START_STEP -le $CURRENT_STEP ] ; then | |
299 echo ">>> Step $CURRENT_STEP: Upload for code review." | |
300 echo -n "Please enter the email address of a V8 reviewer for your patch: " | |
301 read REVIEWER | |
302 git cl upload -r "$REVIEWER" --send-mail \ | |
303 || die "'git cl upload' failed, please try again." | |
304 fi | |
305 | 197 |
306 let CURRENT_STEP+=1 | 198 let CURRENT_STEP+=1 |
307 if [ $START_STEP -le $CURRENT_STEP ] ; then | 199 if [ $START_STEP -le $CURRENT_STEP ] ; then |
| 200 echo ">>> Step $CURRENT_STEP: Commit to the repository." |
308 restore_if_unset "MERGE_TO_BRANCH" | 201 restore_if_unset "MERGE_TO_BRANCH" |
309 git checkout $BRANCHNAME \ | 202 git checkout $BRANCHNAME \ |
310 || die "cannot ensure that the current branch is $BRANCHNAME" | 203 || die "cannot ensure that the current branch is $BRANCHNAME" |
311 echo ">>> Step $CURRENT_STEP: Commit to the repository." | 204 wait_for_lgtm |
312 echo "Please wait for an LGTM, then type \"LGTM<Return>\" to commit your \ | |
313 change. (If you need to iterate on the patch or double check that it's \ | |
314 sane, do so in another shell, but remember to not change the headline of \ | |
315 the uploaded CL." | |
316 unset ANSWER | |
317 while [ "$ANSWER" != "LGTM" ] ; do | |
318 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." | |
319 echo -n "> " | |
320 read ANSWER | |
321 done | |
322 git cl dcommit || die "failed to commit to $MERGE_TO_BRANCH" | 205 git cl dcommit || die "failed to commit to $MERGE_TO_BRANCH" |
323 fi | 206 fi |
324 | 207 |
325 let CURRENT_STEP+=1 | 208 let CURRENT_STEP+=1 |
326 if [ $START_STEP -le $CURRENT_STEP ] ; then | 209 if [ $START_STEP -le $CURRENT_STEP ] ; then |
| 210 echo ">>> Step $CURRENT_STEP: Determine svn commit revision" |
327 restore_if_unset "NEW_COMMIT_MSG" | 211 restore_if_unset "NEW_COMMIT_MSG" |
328 restore_if_unset "MERGE_TO_BRANCH" | 212 restore_if_unset "MERGE_TO_BRANCH" |
329 echo ">>> Step $CURRENT_STEP: Determine svn commit revision" | |
330 git svn fetch || die "'git svn fetch' failed." | 213 git svn fetch || die "'git svn fetch' failed." |
331 COMMIT_HASH=$(git log -1 --format=%H --grep="$NEW_COMMIT_MSG" \ | 214 COMMIT_HASH=$(git log -1 --format=%H --grep="$NEW_COMMIT_MSG" \ |
332 svn/$MERGE_TO_BRANCH) | 215 svn/$MERGE_TO_BRANCH) |
333 [[ -z "$COMMIT_HASH" ]] && die "Unable to map git commit to svn revision" | 216 [[ -z "$COMMIT_HASH" ]] && die "Unable to map git commit to svn revision" |
334 SVN_REVISION=$(git svn find-rev $COMMIT_HASH) | 217 SVN_REVISION=$(git svn find-rev $COMMIT_HASH) |
335 echo "subversion revision number is r$SVN_REVISION" | 218 echo "subversion revision number is r$SVN_REVISION" |
336 persist "SVN_REVISION" | 219 persist "SVN_REVISION" |
337 fi | 220 fi |
338 | 221 |
339 let CURRENT_STEP+=1 | 222 let CURRENT_STEP+=1 |
340 if [ $START_STEP -le $CURRENT_STEP ] ; then | 223 if [ $START_STEP -le $CURRENT_STEP ] ; then |
| 224 echo ">>> Step $CURRENT_STEP: Create the tag." |
341 restore_if_unset "SVN_REVISION" | 225 restore_if_unset "SVN_REVISION" |
342 restore_if_unset "NEWMAJOR" | 226 restore_version_if_unset "NEW" |
343 restore_if_unset "NEWMINOR" | |
344 restore_if_unset "NEWBUILD" | |
345 restore_if_unset "NEWPATCH" | |
346 echo ">>> Step $CURRENT_STEP: Create the tag." | |
347 echo "Creating tag svn/tags/$NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" | 227 echo "Creating tag svn/tags/$NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" |
| 228 if [ "$MERGE_TO_BRANCH" == "trunk" ] ; then |
| 229 TO_URL="$MERGE_TO_BRANCH" |
| 230 else |
| 231 TO_URL="branches/$MERGE_TO_BRANCH" |
| 232 fi |
348 svn copy -r $SVN_REVISION \ | 233 svn copy -r $SVN_REVISION \ |
349 https://v8.googlecode.com/svn/branches/$MERGE_TO_BRANCH \ | 234 https://v8.googlecode.com/svn/$TO_URL \ |
350 https://v8.googlecode.com/svn/tags/$NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH \ | 235 https://v8.googlecode.com/svn/tags/$NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH \ |
351 -m "Tagging version $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" | 236 -m "Tagging version $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" |
352 fi | 237 fi |
353 | 238 |
354 let CURRENT_STEP+=1 | 239 let CURRENT_STEP+=1 |
355 if [ $START_STEP -le $CURRENT_STEP ] ; then | 240 if [ $START_STEP -le $CURRENT_STEP ] ; then |
356 echo ">>> Step $CURRENT_STEP: Cleanup." | 241 echo ">>> Step $CURRENT_STEP: Cleanup." |
357 restore_if_unset "CURRENT_BRANCH" | 242 common_cleanup |
358 git checkout -f $CURRENT_BRANCH | |
359 [[ "$BRANCHNAME" != "$CURRENT_BRANCH" ]] && git branch -D $BRANCHNAME | |
360 rm -f "$ALREADY_MERGING_SENTINEL_FILE" | |
361 fi | 243 fi |
OLD | NEW |