OLD | NEW |
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 sane, do so in another shell, but remember to not change the headline of \ | 173 sane, do so in another shell, but remember to not change the headline of \ |
174 the uploaded CL." | 174 the uploaded CL." |
175 unset ANSWER | 175 unset ANSWER |
176 while [ "$ANSWER" != "LGTM" ] ; do | 176 while [ "$ANSWER" != "LGTM" ] ; do |
177 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." | 177 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." |
178 echo -n "> " | 178 echo -n "> " |
179 read ANSWER | 179 read ANSWER |
180 done | 180 done |
181 } | 181 } |
182 | 182 |
183 wait_for_resolving_conflicts() { | |
184 echo "Applying the patch failed. Either type \"ABORT<Return>\", or \ | |
185 resolve the conflicts, stage the touched files with 'git add' and \ | |
186 type \"RESOLVED<Return>\"" | |
187 unset ANSWER | |
188 while [ "$ANSWER" != "RESOLVED" ] ; do | |
189 [[ "$ANSWER" == "ABORT" ]] && die "Applying the patch failed." | |
190 [[ -n "$ANSWER" ]] && echo "That was not 'RESOLVED' or 'ABORT'." | |
191 echo -n "> " | |
192 read ANSWER | |
193 done | |
194 } | |
195 | |
196 # Takes a file containing the patch to apply as first argument. | 183 # Takes a file containing the patch to apply as first argument. |
197 apply_patch() { | 184 apply_patch() { |
198 patch $REVERSE_PATCH -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \ | 185 patch $REVERSE_PATCH -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \ |
199 { cat "$PATCH_OUTPUT_FILE" && wait_for_resolving_conflicts; } | 186 { cat "$PATCH_OUTPUT_FILE" && die "Applying the patch failed."; } |
200 tee < "$PATCH_OUTPUT_FILE" >(grep "patching file" \ | 187 tee < "$PATCH_OUTPUT_FILE" >(grep "patching file" \ |
201 | awk '{print $NF}' >> "$TOUCHED_FILES_FILE") | 188 | awk '{print $NF}' >> "$TOUCHED_FILES_FILE") |
202 rm "$PATCH_OUTPUT_FILE" | 189 rm "$PATCH_OUTPUT_FILE" |
203 } | 190 } |
204 | 191 |
205 stage_files() { | 192 stage_files() { |
206 # Stage added and modified files. | 193 # Stage added and modified files. |
207 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE") | 194 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE") |
208 for FILE in $TOUCHED_FILES ; do | 195 for FILE in $TOUCHED_FILES ; do |
209 git add "$FILE" | 196 git add "$FILE" |
210 done | 197 done |
211 # Stage deleted files. | 198 # Stage deleted files. |
212 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \ | 199 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \ |
213 | awk '{print $NF}') | 200 | awk '{print $NF}') |
214 for FILE in $DELETED_FILES ; do | 201 for FILE in $DELETED_FILES ; do |
215 git rm "$FILE" | 202 git rm "$FILE" |
216 done | 203 done |
217 rm -f "$TOUCHED_FILES_FILE" | 204 rm -f "$TOUCHED_FILES_FILE" |
218 } | 205 } |
OLD | NEW |