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

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

Issue 10538056: Merged r11546 into 3.9 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.9
Patch Set: Created 8 years, 6 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 | « tools/check-static-initializers.sh ('k') | 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 die "Can't continue. Please delete branch $1 and try again." 70 die "Can't continue. Please delete branch $1 and try again."
71 fi 71 fi
72 fi 72 fi
73 } 73 }
74 74
75 # Persist and restore variables to support canceling/resuming execution 75 # Persist and restore variables to support canceling/resuming execution
76 # of this script. 76 # of this script.
77 persist() { 77 persist() {
78 local VARNAME=$1 78 local VARNAME=$1
79 local FILE="$PERSISTFILE_BASENAME-$VARNAME" 79 local FILE="$PERSISTFILE_BASENAME-$VARNAME"
80 echo "${!VARNAME}" > $FILE 80 local VALUE="${!VARNAME}"
81 if [ -z "$VALUE" ] ; then
82 VALUE="__EMPTY__"
83 fi
84 echo "$VALUE" > $FILE
81 } 85 }
82 86
83 restore() { 87 restore() {
84 local VARNAME=$1 88 local VARNAME=$1
85 local FILE="$PERSISTFILE_BASENAME-$VARNAME" 89 local FILE="$PERSISTFILE_BASENAME-$VARNAME"
86 local VALUE="$(cat $FILE)" 90 local VALUE="$(cat $FILE)"
91 [[ -z "$VALUE" ]] && die "Variable '$VARNAME' could not be restored."
92 if [ "$VALUE" == "__EMPTY__" ] ; then
93 VALUE=""
94 fi
87 eval "$VARNAME=\"$VALUE\"" 95 eval "$VARNAME=\"$VALUE\""
88 } 96 }
89 97
90 restore_if_unset() { 98 restore_if_unset() {
91 local VARNAME=$1 99 local VARNAME=$1
92 [[ -z "${!VARNAME}" ]] && restore "$VARNAME" 100 [[ -z "${!VARNAME}" ]] && restore "$VARNAME"
93 [[ -z "${!VARNAME}" ]] && die "Variable '$VARNAME' could not be restored."
94 } 101 }
95 102
96 initial_environment_checks() { 103 initial_environment_checks() {
97 # Cancel if this is not a git checkout. 104 # Cancel if this is not a git checkout.
98 [[ -d .git ]] \ 105 [[ -d .git ]] \
99 || die "This is not a git checkout, this script won't work for you." 106 || die "This is not a git checkout, this script won't work for you."
100 107
101 # Cancel if EDITOR is unset or not executable. 108 # Cancel if EDITOR is unset or not executable.
102 [[ -n "$EDITOR" && -x "$(which $EDITOR)" ]] \ 109 [[ -n "$EDITOR" && -x "$(which $EDITOR)" ]] \
103 || die "Please set your EDITOR environment variable, you'll need it." 110 || die "Please set your EDITOR environment variable, you'll need it."
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 unset ANSWER 175 unset ANSWER
169 while [ "$ANSWER" != "LGTM" ] ; do 176 while [ "$ANSWER" != "LGTM" ] ; do
170 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." 177 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'."
171 echo -n "> " 178 echo -n "> "
172 read ANSWER 179 read ANSWER
173 done 180 done
174 } 181 }
175 182
176 # Takes a file containing the patch to apply as first argument. 183 # Takes a file containing the patch to apply as first argument.
177 apply_patch() { 184 apply_patch() {
178 patch -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \ 185 patch $REVERSE_PATCH -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \
179 { cat "$PATCH_OUTPUT_FILE" && die "Applying the patch failed."; } 186 { cat "$PATCH_OUTPUT_FILE" && die "Applying the patch failed."; }
180 tee < "$PATCH_OUTPUT_FILE" >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE") 187 tee < "$PATCH_OUTPUT_FILE" >(grep "patching file" \
188 | awk '{print $NF}' >> "$TOUCHED_FILES_FILE")
181 rm "$PATCH_OUTPUT_FILE" 189 rm "$PATCH_OUTPUT_FILE"
182 } 190 }
183 191
184 stage_files() { 192 stage_files() {
185 # Stage added and modified files. 193 # Stage added and modified files.
186 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE") 194 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE")
187 for FILE in $TOUCHED_FILES ; do 195 for FILE in $TOUCHED_FILES ; do
188 git add "$FILE" 196 git add "$FILE"
189 done 197 done
190 # Stage deleted files. 198 # Stage deleted files.
191 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \ 199 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \
192 | awk '{print $NF}') 200 | awk '{print $NF}')
193 for FILE in $DELETED_FILES ; do 201 for FILE in $DELETED_FILES ; do
194 git rm "$FILE" 202 git rm "$FILE"
195 done 203 done
196 rm -f "$TOUCHED_FILES_FILE" 204 rm -f "$TOUCHED_FILES_FILE"
197 } 205 }
OLDNEW
« no previous file with comments | « tools/check-static-initializers.sh ('k') | tools/merge-to-branch.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698