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

Side by Side Diff: tools/common-includes.sh

Issue 11031065: push-to-trunk.sh/merge-to-branch.sh: use "git apply" instead of "patch" to apply patches (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | tools/merge-to-branch.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 18 matching lines...) Expand all
29 # scripts in this directory. It is not meant to be executed by itself. 29 # scripts in this directory. It is not meant to be executed by itself.
30 30
31 # Important: before including this file, the following variables must be set: 31 # Important: before including this file, the following variables must be set:
32 # - BRANCHNAME 32 # - BRANCHNAME
33 # - PERSISTFILE_BASENAME 33 # - PERSISTFILE_BASENAME
34 34
35 TEMP_BRANCH=$BRANCHNAME-temporary-branch-created-by-script 35 TEMP_BRANCH=$BRANCHNAME-temporary-branch-created-by-script
36 VERSION_FILE="src/version.cc" 36 VERSION_FILE="src/version.cc"
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 PATCH_OUTPUT_FILE="$PERSISTFILE_BASENAME-patch-output"
40 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg" 39 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg"
41 TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files"
42 TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision" 40 TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision"
43 START_STEP=0 41 START_STEP=0
44 CURRENT_STEP=0 42 CURRENT_STEP=0
45 43
46 die() { 44 die() {
47 [[ -n "$1" ]] && echo "Error: $1" 45 [[ -n "$1" ]] && echo "Error: $1"
48 echo "Exiting." 46 echo "Exiting."
49 exit 1 47 exit 1
50 } 48 }
51 49
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 the uploaded CL." 172 the uploaded CL."
175 unset ANSWER 173 unset ANSWER
176 while [ "$ANSWER" != "LGTM" ] ; do 174 while [ "$ANSWER" != "LGTM" ] ; do
177 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." 175 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'."
178 echo -n "> " 176 echo -n "> "
179 read ANSWER 177 read ANSWER
180 done 178 done
181 } 179 }
182 180
183 wait_for_resolving_conflicts() { 181 wait_for_resolving_conflicts() {
184 echo "Applying the patch failed. Either type \"ABORT<Return>\", or \ 182 echo "Applying the patch \"$1\" failed. Either type \"ABORT<Return>\", or \
185 resolve the conflicts, stage the touched files with 'git add' and \ 183 resolve the conflicts, stage *all* touched files with 'git add', and \
186 type \"RESOLVED<Return>\"" 184 type \"RESOLVED<Return>\""
187 unset ANSWER 185 unset ANSWER
188 while [ "$ANSWER" != "RESOLVED" ] ; do 186 while [ "$ANSWER" != "RESOLVED" ] ; do
189 [[ "$ANSWER" == "ABORT" ]] && die "Applying the patch failed." 187 [[ "$ANSWER" == "ABORT" ]] && die "Applying the patch failed."
190 [[ -n "$ANSWER" ]] && echo "That was not 'RESOLVED' or 'ABORT'." 188 [[ -n "$ANSWER" ]] && echo "That was not 'RESOLVED' or 'ABORT'."
191 echo -n "> " 189 echo -n "> "
192 read ANSWER 190 read ANSWER
193 done 191 done
194 } 192 }
195 193
196 # Takes a file containing the patch to apply as first argument. 194 # Takes a file containing the patch to apply as first argument.
197 apply_patch() { 195 apply_patch() {
198 patch $REVERSE_PATCH -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \ 196 git apply --index --reject $REVERSE_PATCH "$1" || \
199 { cat "$PATCH_OUTPUT_FILE" && wait_for_resolving_conflicts; } 197 wait_for_resolving_conflicts "$1";
200 tee < "$PATCH_OUTPUT_FILE" >(grep "patching file" \
201 | awk '{print $NF}' >> "$TOUCHED_FILES_FILE")
202 rm "$PATCH_OUTPUT_FILE"
203 } 198 }
204
205 stage_files() {
206 # Stage added and modified files.
207 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE")
208 for FILE in $TOUCHED_FILES ; do
209 git add "$FILE"
210 done
211 # Stage deleted files.
212 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \
213 | awk '{print $NF}')
214 for FILE in $DELETED_FILES ; do
215 git rm "$FILE"
216 done
217 rm -f "$TOUCHED_FILES_FILE"
218 }
OLDNEW
« no previous file with comments | « no previous file | tools/merge-to-branch.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698