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

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

Issue 9844015: Allow a commit message to be specified to merge-to-branch.sh (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Handle persisting empty variables correctly Created 8 years, 8 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 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)"
Sven Panne 2012/03/28 11:40:39 I'm just curious: Why is this detour via __EMPTY__
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 git add "$FILE" 195 git add "$FILE"
189 done 196 done
190 # Stage deleted files. 197 # Stage deleted files.
191 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \ 198 DELETED_FILES=$(git status -s -uno --porcelain | grep "^ D" \
192 | awk '{print $NF}') 199 | awk '{print $NF}')
193 for FILE in $DELETED_FILES ; do 200 for FILE in $DELETED_FILES ; do
194 git rm "$FILE" 201 git rm "$FILE"
195 done 202 done
196 rm -f "$TOUCHED_FILES_FILE" 203 rm -f "$TOUCHED_FILES_FILE"
197 } 204 }
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