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

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

Issue 9701102: Fix bugs in tools/merge-to-branch.sh (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 9 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 | no next file » | 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"
39 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg" 40 COMMITMSG_FILE="$PERSISTFILE_BASENAME-commitmsg"
40 TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files" 41 TOUCHED_FILES_FILE="$PERSISTFILE_BASENAME-touched-files"
41 TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision" 42 TRUNK_REVISION_FILE="$PERSISTFILE_BASENAME-trunkrevision"
42 START_STEP=0 43 START_STEP=0
43 CURRENT_STEP=0 44 CURRENT_STEP=0
44 45
45 die() { 46 die() {
46 [[ -n "$1" ]] && echo "Error: $1" 47 [[ -n "$1" ]] && echo "Error: $1"
47 echo "Exiting." 48 echo "Exiting."
48 exit 1 49 exit 1
49 } 50 }
50 51
51 confirm() { 52 confirm() {
52 echo -n "$1 [Y/n] " 53 echo -n "$1 [Y/n] "
53 read ANSWER 54 read ANSWER
54 if [[ -z "$ANSWER" || "$ANSWER" == "Y" || "$ANSWER" == "y" ]] ; then 55 if [[ -z "$ANSWER" || "$ANSWER" == "Y" || "$ANSWER" == "y" ]] ; then
55 return 0 56 return 0
56 else 57 else
57 return 1 58 return 1
58 fi 59 fi
59 } 60 }
60 61
61 delete_branch() { 62 delete_branch() {
62 local MATCH=$(git branch | grep $1 | awk '{print $NF}' ) 63 local MATCH=$(git branch | grep "$1" | awk '{print $NF}' | grep -x $1)
Jakob Kummerow 2012/03/16 16:01:11 You don't need the quotes around "$1", but I guess
63 if [ "$MATCH" == "$1" ] ; then 64 if [ "$MATCH" == "$1" ] ; then
64 confirm "Branch $1 exists, do you want to delete it?" 65 confirm "Branch $1 exists, do you want to delete it?"
65 if [ $? -eq 0 ] ; then 66 if [ $? -eq 0 ] ; then
66 git branch -D $1 || die "Deleting branch '$1' failed." 67 git branch -D $1 || die "Deleting branch '$1' failed."
67 echo "Branch $1 deleted." 68 echo "Branch $1 deleted."
68 else 69 else
69 die "Can't continue. Please delete branch $1 and try again." 70 die "Can't continue. Please delete branch $1 and try again."
70 fi 71 fi
71 fi 72 fi
72 } 73 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 unset ANSWER 168 unset ANSWER
168 while [ "$ANSWER" != "LGTM" ] ; do 169 while [ "$ANSWER" != "LGTM" ] ; do
169 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'." 170 [[ -n "$ANSWER" ]] && echo "That was not 'LGTM'."
170 echo -n "> " 171 echo -n "> "
171 read ANSWER 172 read ANSWER
172 done 173 done
173 } 174 }
174 175
175 # Takes a file containing the patch to apply as first argument. 176 # Takes a file containing the patch to apply as first argument.
176 apply_patch() { 177 apply_patch() {
177 patch -p1 < "$1" | tee >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE") 178 patch -p1 < "$1" > "$PATCH_OUTPUT_FILE" || \
178 [[ $? -eq 0 ]] || die "Applying the patch failed." 179 cat "$PATCH_OUTPUT_FILE" && die "Applying the patch failed."
180 tee < "$PATCH_OUTPUT_FILE" >(awk '{print $NF}' >> "$TOUCHED_FILES_FILE")
181 rm "$PATCH_OUTPUT_FILE"
179 } 182 }
180 183
181 stage_files() { 184 stage_files() {
182 # Stage added and modified files. 185 # Stage added and modified files.
183 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE") 186 TOUCHED_FILES=$(cat "$TOUCHED_FILES_FILE")
184 for FILE in $TOUCHED_FILES ; do 187 for FILE in $TOUCHED_FILES ; do
185 git add "$FILE" 188 git add "$FILE"
186 done 189 done
187 # Stage deleted files. 190 # Stage deleted files.
188 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \ 191 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \
189 | awk '{print $NF}') 192 | awk '{print $NF}')
190 for FILE in $DELETED_FILES ; do 193 for FILE in $DELETED_FILES ; do
191 git rm "$FILE" 194 git rm "$FILE"
192 done 195 done
193 rm -f "$TOUCHED_FILES_FILE" 196 rm -f "$TOUCHED_FILES_FILE"
194 } 197 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698