| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright 2010 The Native Client Authors. All rights reserved. | 2 # Copyright 2011 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # be found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 ###################################################################### | 6 ###################################################################### |
| 7 # | 7 # |
| 8 # This script facilitates merging changes from the LLVM subversion | 8 # This script facilitates merging changes from the LLVM subversion |
| 9 # repository into the PNaCl Mercurial repository. | 9 # repository into the PNaCl Mercurial repository. |
| 10 # | 10 # |
| 11 ###################################################################### | 11 ###################################################################### |
| 12 set -o nounset | 12 set -o nounset |
| 13 set -o errexit | 13 set -o errexit |
| 14 | 14 |
| 15 # Make sure this script is run from the right place | 15 # Make sure this script is run from the right place |
| 16 if [[ $(basename $(pwd)) != "native_client" ]] ; then | 16 if [[ $(basename $(pwd)) != "native_client" ]] ; then |
| 17 echo "ERROR: run this script from the native_client/ dir" | 17 echo "ERROR: run this script from the native_client/ dir" |
| 18 exit -1 | 18 exit -1 |
| 19 fi | 19 fi |
| 20 | 20 |
| 21 source tools/llvm/common-tools.sh | 21 source tools/llvm/common-tools.sh |
| 22 readonly NACL_ROOT="$(pwd)" |
| 23 SetScriptPath "${NACL_ROOT}/tools/llvm/merge-tool.sh" |
| 24 SetLogDirectory "${NACL_ROOT}/toolchain/hg-log" |
| 25 readonly SCRIPT_PATH="$0" |
| 22 ###################################################################### | 26 ###################################################################### |
| 23 | 27 |
| 24 # Location of the mercurial repositories | 28 # Location of the mercurial repositories |
| 25 # These should match the values in utman.sh | 29 # These should match the values in utman.sh |
| 26 readonly TC_SRC="$(pwd)/hg" | 30 readonly TC_SRC="$(pwd)/hg" |
| 27 readonly TC_SRC_LLVM="${TC_SRC}/llvm" | 31 readonly TC_SRC_UPSTREAM="${TC_SRC}/upstream" |
| 28 readonly TC_SRC_LLVM_GCC="${TC_SRC}/llvm-gcc" | |
| 29 | 32 |
| 30 # Location of the upstream LLVM repository | 33 readonly PREDIFF="${TC_SRC}/prediff" |
| 31 readonly MASTER_LLVM_BASE="http://llvm.org/svn/llvm-project" | 34 readonly POSTDIFF="${TC_SRC}/postdiff" |
| 32 readonly MASTER_LLVM_URL="${MASTER_LLVM_BASE}/llvm/trunk" | |
| 33 readonly MASTER_LLVM_GCC_URL="${MASTER_LLVM_BASE}/llvm-gcc-4.2/trunk" | |
| 34 | |
| 35 readonly MASTER_LLVM="${TC_SRC}/master-llvm" | |
| 36 readonly MASTER_LLVM_GCC="${TC_SRC}/master-llvm-gcc" | |
| 37 | 35 |
| 38 | 36 |
| 39 BASEDIR="$(pwd)" | 37 # These variables should be set to the directories containing svn checkouts |
| 38 # of the upstream LLVM and LLVM-GCC repositories, respectively. These variables |
| 39 # must be specified in the environment to this script. |
| 40 readonly MASTER_LLVM=${MASTER_LLVM:-} |
| 41 readonly MASTER_LLVM_GCC=${MASTER_LLVM_GCC:-} |
| 42 |
| 43 # TODO(pdox): Refactor repository checkout into a separate script |
| 44 # so that we don't need to invoke utman. |
| 40 utman() { | 45 utman() { |
| 41 pushd "${BASEDIR}" > /dev/null | 46 UTMAN_UPSTREAM=true "${NACL_ROOT}"/tools/llvm/utman.sh "$@" |
| 42 tools/llvm/utman.sh "$@" | |
| 43 popd > /dev/null | |
| 44 } | 47 } |
| 45 hg-pull-llvm() { utman hg-pull-llvm "$@" ; } | 48 hg-checkout-upstream() { utman hg-checkout-upstream "$@" ; } |
| 46 hg-pull-llvm-gcc() { utman hg-pull-llvm-gcc "$@" ; } | |
| 47 hg-checkout-llvm() { utman hg-checkout-llvm "$@" ; } | |
| 48 hg-checkout-llvm-gcc() { utman hg-checkout-llvm-gcc "$@" ; } | |
| 49 | 49 |
| 50 #@ all - Do LLVM and LLVM-GCC merge (all steps) | 50 check-svn-repos() { |
| 51 all() { | 51 if [ -z "${MASTER_LLVM}" ] || |
| 52 [ -z "${MASTER_LLVM_GCC}" ]; then |
| 53 Fatal "You must set environmental variables MASTER_LLVM and MASTER_LLVM_GCC" |
| 54 fi |
| 55 MERGE_REVISION=$(get-merge-revision) |
| 56 Banner "MERGE REVISION: ${MERGE_REVISION}" |
| 57 } |
| 58 |
| 59 #@ auto - Non-interactive merge |
| 60 auto() { |
| 61 INTERACTIVE_MERGE=false |
| 62 export DISPLAY="" |
| 63 merge-all |
| 64 } |
| 65 |
| 66 #@ manual - Interactive merge |
| 67 manual() { |
| 68 INTERACTIVE_MERGE=true |
| 69 merge-all |
| 70 } |
| 71 |
| 72 #+ merge-all - Merge all the things |
| 73 merge-all() { |
| 74 hg-checkout-upstream |
| 52 assert-clean | 75 assert-clean |
| 76 setup-hgrc |
| 53 | 77 |
| 54 checkout-all | 78 generate-pre-diff |
| 55 choose-revision | |
| 56 | 79 |
| 57 update-llvm-gcc-vendor | 80 commit-vendor |
| 58 merge-llvm-gcc | 81 hg-merge |
| 59 diff-diff-llvm-gcc | |
| 60 | 82 |
| 61 update-llvm-vendor | 83 generate-post-diff |
| 62 merge-llvm | 84 |
| 63 diff-diff-llvm | 85 if ${INTERACTIVE_MERGE}; then |
| 86 vim-diff-diff |
| 87 else |
| 88 dump-diff-diff |
| 89 fi |
| 64 | 90 |
| 65 echo "********************************************************************" | 91 echo "********************************************************************" |
| 66 echo "The llvm and llvm-gcc working directories are now in a merged state." | 92 echo "The llvm and llvm-gcc working directories are now in a merged state." |
| 67 echo "Before you commit and push, you should build PNaCl and run all tests." | 93 echo "Before you commit and push, you should build PNaCl and run all tests." |
| 68 echo "For example:" | |
| 69 echo " tools/llvm/utman.sh clean" | |
| 70 echo " tools/llvm/utman.sh all" | |
| 71 echo " tools/llvm/utman.sh test-all" | |
| 72 echo " tests/spec2k/bot_spec.sh 2 <spec-dir>" | |
| 73 echo " tests/spec2k/bot_spec.sh 3 <spec-dir>" | |
| 74 echo "" | 94 echo "" |
| 75 echo "Expect lots of bugs. You may need to fix and rebuild several times." | 95 echo "Expect lots of bugs. You may need to fix and rebuild several times." |
| 76 echo "When you are confident all tests are passing, you can commit and push" | 96 echo "When you are confident all tests are passing, you can commit and push" |
| 77 echo "the merged working directories with:" | 97 echo "the merged working directory with:" |
| 78 echo " tools/llvm/merge-tool.sh final-commit" | 98 echo " tools/llvm/merge-tool.sh final-commit" |
| 79 echo "********************************************************************" | 99 echo "********************************************************************" |
| 80 } | 100 } |
| 81 | 101 |
| 102 setup-hgrc() { |
| 103 cp "${NACL_ROOT}/tools/llvm/hgrc" \ |
| 104 "${TC_SRC_UPSTREAM}/.hg/hgrc" |
| 105 } |
| 106 |
| 82 assert-clean() { | 107 assert-clean() { |
| 83 if [ -d "${MASTER_LLVM}" ]; then | 108 svn-assert-no-changes "${MASTER_LLVM}" |
| 84 svn-assert-no-changes "${MASTER_LLVM}" | 109 svn-assert-no-changes "${MASTER_LLVM_GCC}" |
| 85 fi | |
| 86 | 110 |
| 87 if [ -d "${MASTER_LLVM_GCC}" ]; then | 111 hg-assert-no-changes "${TC_SRC_UPSTREAM}" |
| 88 svn-assert-no-changes "${MASTER_LLVM_GCC}" | 112 hg-assert-no-outgoing "${TC_SRC_UPSTREAM}" |
| 89 fi | |
| 90 | |
| 91 if [ -d "${TC_SRC_LLVM}" ]; then | |
| 92 hg-assert-no-changes "${TC_SRC_LLVM}" | |
| 93 hg-assert-no-outgoing "${TC_SRC_LLVM}" | |
| 94 fi | |
| 95 | |
| 96 if [ -d "${TC_SRC_LLVM_GCC}" ]; then | |
| 97 hg-assert-no-changes "${TC_SRC_LLVM_GCC}" | |
| 98 hg-assert-no-outgoing "${TC_SRC_LLVM_GCC}" | |
| 99 fi | |
| 100 } | 113 } |
| 101 | 114 |
| 102 #@ clean - Clean/revert mercurial repositories | 115 #@ clean - Clean/revert mercurial repositories |
| 103 clean() { | 116 clean() { |
| 104 StepBanner "CLEAN - Cleaning repositories" | 117 StepBanner "CLEAN - Cleaning repositories" |
| 105 Banner "WARNING: All local changes to hg/llvm and hg/llvm-gcc will be erased" | 118 clean-upstream |
| 106 if ! confirm-yes "Are you sure you want to do this?" ; then | |
| 107 echo "Cancelled" | |
| 108 exit -1 | |
| 109 fi | |
| 110 if ! confirm-yes "Are you really, really sure you want do this?" ; then | |
| 111 echo "Cancelled" | |
| 112 exit -1 | |
| 113 fi | |
| 114 clean-llvm | |
| 115 clean-llvm-gcc | |
| 116 } | 119 } |
| 117 | 120 |
| 118 #+ clean-llvm | 121 #+ clean-upstream |
| 119 clean-llvm() { | 122 clean-upstream() { |
| 120 StepBanner "CLEAN" "Cleaning hg llvm repository" | 123 StepBanner "CLEAN" "Cleaning hg upstream repository" |
| 121 rm -rf "${TC_SRC_LLVM}" | 124 rm -rf "${TC_SRC_UPSTREAM}" |
| 122 } | 125 } |
| 123 | 126 |
| 124 #+ clean-llvm-gcc | 127 #+ get-merge-revision - Get the current SVN revision |
| 125 clean-llvm-gcc() { | 128 get-merge-revision() { |
| 126 StepBanner "CLEAN" "Cleaning hg llvm-gcc repository" | |
| 127 rm -rf "${TC_SRC_LLVM_GCC}" | |
| 128 } | |
| 129 | |
| 130 #@ checkout-all - Checkout repositories | |
| 131 checkout-all() { | |
| 132 StepBanner "checkout-all - Checkout all repositories" | |
| 133 | |
| 134 # Checkout LLVM repositories | |
| 135 StepBanner "checkout-all" "Checking out SVN repositories" | |
| 136 svn-checkout "${MASTER_LLVM_URL}" "${MASTER_LLVM}" | |
| 137 svn-checkout "${MASTER_LLVM_GCC_URL}" "${MASTER_LLVM_GCC}" | |
| 138 | |
| 139 # Checkout the hg repositories | |
| 140 StepBanner "checkout-all" "Checking out HG repositories" | |
| 141 hg-checkout-llvm | |
| 142 hg-checkout-llvm-gcc | |
| 143 } | |
| 144 | |
| 145 #+ get-revision - Get the current SVN revision | |
| 146 get-revision() { | |
| 147 local llvm_rev=$(svn-get-revision "${MASTER_LLVM}") | 129 local llvm_rev=$(svn-get-revision "${MASTER_LLVM}") |
| 148 local llvm_gcc_rev=$(svn-get-revision "${MASTER_LLVM_GCC}") | 130 local llvm_gcc_rev=$(svn-get-revision "${MASTER_LLVM_GCC}") |
| 149 | 131 |
| 150 if [ "${llvm_rev}" -ne "${llvm_gcc_rev}" ]; then | 132 if [ "${llvm_rev}" -ne "${llvm_gcc_rev}" ]; then |
| 151 echo -n "Error: Unexpected mismatch between " 1>&2 | 133 echo -n "Error: Unexpected mismatch between " 1>&2 |
| 152 echo "SVN revisions of llvm and llvm-gcc" 1>&2 | 134 echo "SVN revisions of llvm and llvm-gcc" 1>&2 |
| 153 exit -1 | 135 exit -1 |
| 154 fi | 136 fi |
| 155 echo "${llvm_rev}" | 137 echo "${llvm_rev}" |
| 156 } | 138 } |
| 157 | 139 |
| 158 #@ choose-revision - Choose LLVM revision | 140 #+ generate-pre-diff - Generate vendor:pnacl-sfi diff prior to merge |
| 159 choose-revision() { | 141 generate-pre-diff() { |
| 160 StepBanner "choose-revision - Choose LLVM Revision" | 142 spushd "${TC_SRC_UPSTREAM}" |
| 161 echo | 143 hg diff -r vendor:pnacl-sfi &> "${PREDIFF}" |
| 162 echo "Go to http://google1.osuosl.org:8011/ for LLVM build status" | 144 spopd |
| 163 echo | |
| 164 local rev | |
| 165 while true; do | |
| 166 echo -n "Please enter an LLVM revision (or 'tip'): " | |
| 167 read rev | |
| 168 if [[ "$rev" == "tip" ]]; then | |
| 169 break | |
| 170 fi | |
| 171 if [[ "$rev" =~ ^[0-9]+$ ]]; then | |
| 172 break | |
| 173 fi | |
| 174 echo "Invalid input." | |
| 175 done | |
| 176 | |
| 177 # Update the SVN repositories to ${rev} | |
| 178 StepBanner "choose-revision" "Updating LLVM repository to ${rev}" | |
| 179 svn-update "${MASTER_LLVM}" "${rev}" | |
| 180 svn-update "${MASTER_LLVM_GCC}" "${rev}" | |
| 181 } | 145 } |
| 182 | 146 |
| 183 #@ update-llvm-vendor - Apply update to vendor branch for llvm | 147 #+ generate-post-diff - Generate vendor:pnacl-sfi diff after merge |
| 184 update-llvm-vendor() { | 148 generate-post-diff() { |
| 185 local fnid="update-llvm-vendor" | 149 spushd "${TC_SRC_UPSTREAM}" |
| 186 StepBanner "${fnid} - Freshen hg 'vendor' branch" | 150 hg diff -r vendor &> "${POSTDIFF}" |
| 151 spopd |
| 152 } |
| 187 | 153 |
| 188 StepBanner "${fnid}" "Verifying repository state" | 154 #@ commit-vendor - Apply new commit to vendor branch |
| 189 svn-assert-no-changes "${MASTER_LLVM}" | 155 commit-vendor() { |
| 190 hg-assert-no-changes "${TC_SRC_LLVM}" | 156 local stepid="commit-vendor" |
| 191 hg-assert-no-outgoing "${TC_SRC_LLVM}" | 157 StepBanner "Committing vendor" |
| 192 | 158 |
| 193 StepBanner "${fnid}" "hg pull (llvm)" | 159 StepBanner "${stepid}" "Switching to hg vendor branch" |
| 194 hg-pull-llvm | |
| 195 | 160 |
| 196 StepBanner "${fnid}" "switch to hg branch vendor (llvm)" | 161 hg-update "${TC_SRC_UPSTREAM}" vendor |
| 197 hg-update "${TC_SRC_LLVM}" vendor | |
| 198 StepBanner "${fnid}" "Delete existing vendor source" | |
| 199 rm -rf "${TC_SRC_LLVM}/llvm-trunk" | |
| 200 | 162 |
| 201 StepBanner "${fnid}" "Exporting svn to hg (llvm)" | 163 StepBanner "${stepid}" "Exporting svn to hg" |
| 202 RunWithLog "${fnid}" \ | 164 rm -rf "${TC_SRC_UPSTREAM}/llvm" |
| 203 svn export "${MASTER_LLVM}" "${TC_SRC_LLVM}/llvm-trunk" | 165 svn export "${MASTER_LLVM}" "${TC_SRC_UPSTREAM}/llvm" |
| 204 | 166 |
| 205 StepBanner "${fnid}" "Updating hg file list (llvm)" | 167 rm -rf "${TC_SRC_UPSTREAM}/llvm-gcc" |
| 206 spushd "${TC_SRC_LLVM}" | 168 svn export "${MASTER_LLVM_GCC}" "${TC_SRC_UPSTREAM}/llvm-gcc" |
| 207 RunWithLog "${fnid}" hg add | 169 |
| 208 RunWithLog "${fnid}" hg remove -A | 170 StepBanner "${stepid}" "Updating hg file list" |
| 171 spushd "${TC_SRC_UPSTREAM}" |
| 172 hg add |
| 173 hg remove -A |
| 209 spopd | 174 spopd |
| 210 | 175 |
| 211 hg-status-check LLVM "${TC_SRC_LLVM}" | 176 StepBanner "${stepid}" "Committing vendor branch" |
| 212 | 177 hg-commit "${TC_SRC_UPSTREAM}" "Updating vendor to r${MERGE_REVISION}" |
| 213 local rev=$(get-revision) | |
| 214 StepBanner "${fnid} - Commit hg 'vendor' branch (llvm)" | |
| 215 hg-commit "${TC_SRC_LLVM}" "Updating vendor to r${rev}" | |
| 216 } | 178 } |
| 217 | 179 |
| 218 #@ update-llvm-gcc-vendor - Apply update to vendor branch for llvm-gcc | 180 #@ hg-merge - Merge and resolve conflicts for llvm |
| 219 update-llvm-gcc-vendor() { | 181 hg-merge() { |
| 220 local fnid="update-llvm-gcc-vendor" | 182 StepBanner "hg-merge - Merge and resolve conflicts" |
| 221 StepBanner "${fnid}" "hg pull (llvm-gcc)" | |
| 222 hg-pull-llvm-gcc | |
| 223 | 183 |
| 224 StepBanner "${fnid}" "Verifying repository state" | 184 StepBanner "hg-merge" "Switching to pnacl-sfi branch" |
| 225 svn-assert-no-changes "${MASTER_LLVM_GCC}" | 185 hg-update "${TC_SRC_UPSTREAM}" pnacl-sfi |
| 226 hg-assert-no-changes "${TC_SRC_LLVM_GCC}" | 186 hg-assert-no-changes "${TC_SRC_UPSTREAM}" |
| 227 hg-assert-no-outgoing "${TC_SRC_LLVM_GCC}" | |
| 228 | 187 |
| 229 StepBanner "${fnid}" "switch to hg branch vendor (llvm-gcc)" | 188 StepBanner "hg-merge" "Merging vendor into pnacl-sfi" |
| 230 hg-update "${TC_SRC_LLVM_GCC}" vendor | 189 spushd "${TC_SRC_UPSTREAM}" |
| 231 | |
| 232 StepBanner "${fnid}" "Delete existing vendor source" | |
| 233 rm -rf "${TC_SRC_LLVM_GCC}/llvm-gcc-4.2" | |
| 234 | |
| 235 StepBanner "${fnid}" "Exporting svn to hg (llvm-gcc)" | |
| 236 RunWithLog "${fnid}" \ | |
| 237 svn export "${MASTER_LLVM_GCC}" "${TC_SRC_LLVM_GCC}/llvm-gcc-4.2" | |
| 238 | |
| 239 StepBanner "${fnid}" "Updating hg file list (llvm-gcc)" | |
| 240 spushd "${TC_SRC_LLVM_GCC}" | |
| 241 RunWithLog "${fnid}" hg add | |
| 242 RunWithLog "${fnid}" hg remove -A | |
| 243 spopd | |
| 244 | |
| 245 hg-status-check LLVM-GCC "${TC_SRC_LLVM_GCC}" | |
| 246 | |
| 247 local rev=$(get-revision) | |
| 248 StepBanner "${fnid} - Commit hg 'vendor' branch (llvm-gcc)" | |
| 249 hg-commit "${TC_SRC_LLVM_GCC}" "Updating vendor to r${rev}" | |
| 250 } | |
| 251 | |
| 252 #@ merge-llvm-gcc - Merge and resolve conflicts for llvm-gcc | |
| 253 merge-llvm-gcc() { | |
| 254 StepBanner "merge-llvm-gcc - Merge and resolve conflicts" | |
| 255 | |
| 256 StepBanner "merge-llvm-gcc" "Switch to pnacl-sfi branch" | |
| 257 hg-assert-no-changes "${TC_SRC_LLVM_GCC}" | |
| 258 hg-update "${TC_SRC_LLVM_GCC}" pnacl-sfi | |
| 259 | |
| 260 StepBanner "merge-llvm-gcc" "Merging vendor into pnacl-sfi" | |
| 261 spushd "${TC_SRC_LLVM_GCC}" | |
| 262 hg merge -r vendor | 190 hg merge -r vendor |
| 263 spopd | 191 spopd |
| 264 } | 192 } |
| 265 | 193 |
| 266 #@ merge-llvm - Merge and resolve conflicts for llvm | 194 #@ vim-diff-diff - Review diff-diff using vim |
| 267 merge-llvm() { | 195 vim-diff-diff() { |
| 268 StepBanner "merge-llvm - Merge and resolve conflicts" | 196 vimdiff "${PREDIFF}" "${POSTDIFF}" |
| 269 | |
| 270 StepBanner "merge-llvm" "Switch to pnacl-sfi branch" | |
| 271 hg-assert-no-changes "${TC_SRC_LLVM}" | |
| 272 hg-update "${TC_SRC_LLVM}" pnacl-sfi | |
| 273 | |
| 274 StepBanner "merge-llvm" "Merging vendor into pnacl-sfi" | |
| 275 spushd "${TC_SRC_LLVM}" | |
| 276 hg merge -r vendor | |
| 277 spopd | |
| 278 } | 197 } |
| 279 | 198 |
| 280 #@ diff-diff-llvm - Review diff-diff | 199 #@ dump-diff-diff - Review diff-diff |
| 281 diff-diff-llvm() { | 200 dump-diff-diff() { |
| 282 ( | 201 diff "${PREDIFF}" "${POSTDIFF}" |
| 283 echo "Type 'q' to exit less" | |
| 284 echo "---------------------------------------------------" | |
| 285 tools/llvm/diff-diff.py "${TC_SRC_LLVM}" | |
| 286 ) 2>&1 | less | |
| 287 | |
| 288 if ! confirm-yes "Does the diff-diff for LLVM look correct"; then | |
| 289 echo "Cancelling." | |
| 290 echo "hg repositories remain in uncommitted state." | |
| 291 echo "Use 'tools/llvm/merge-tool.sh clean' to clean them" | |
| 292 exit -1 | |
| 293 fi | |
| 294 } | |
| 295 | |
| 296 #@ diff-diff-llvm-gcc - Review diff-diff | |
| 297 diff-diff-llvm-gcc() { | |
| 298 ( | |
| 299 echo "Type 'q' to exit less" | |
| 300 echo "---------------------------------------------------" | |
| 301 tools/llvm/diff-diff.py "${TC_SRC_LLVM_GCC}" | |
| 302 ) 2>&1 | less | |
| 303 | |
| 304 if ! confirm-yes "Does the diff-diff for LLVM-GCC look correct"; then | |
| 305 echo "Cancelling." | |
| 306 echo "hg repositories remain in uncommitted state." | |
| 307 echo "Use 'tools/llvm/merge-tool.sh clean' to clean them" | |
| 308 exit -1 | |
| 309 fi | |
| 310 } | 202 } |
| 311 | 203 |
| 312 final-commit() { | 204 final-commit() { |
| 313 StepBanner "final-commit" "Committing and pushing merge" | 205 StepBanner "final-commit" "Committing and pushing merge" |
| 314 hg-assert-is-merge "${TC_SRC_LLVM}" | 206 hg-assert-is-merge "${TC_SRC_UPSTREAM}" |
| 315 hg-assert-is-merge "${TC_SRC_LLVM_GCC}" | 207 hg-assert-branch "${TC_SRC_UPSTREAM}" pnacl-sfi |
| 316 hg-assert-branch "${TC_SRC_LLVM}" pnacl-sfi | |
| 317 hg-assert-branch "${TC_SRC_LLVM_GCC}" pnacl-sfi | |
| 318 | 208 |
| 319 Banner "CAUTION: This step will COMMIT and PUSH changes to the repository." | 209 if ${INTERACTIVE_MERGE}; then |
| 320 echo | 210 Banner "CAUTION: This step will COMMIT and PUSH changes to the repository." |
| 321 if ! confirm-yes "Is the merged working directory passing all tests?" ; then | 211 echo |
| 322 echo "Cancelled" | 212 if ! confirm-yes "Is the merged working directory passing all tests?" ; then |
| 323 exit -1 | 213 echo "Cancelled" |
| 324 fi | 214 exit -1 |
| 325 if ! confirm-yes "Are you really sure you want to do this?" ; then | 215 fi |
| 326 echo "Cancelled" | 216 if ! confirm-yes "Are you really sure you want to do this?" ; then |
| 327 exit -1 | 217 echo "Cancelled" |
| 218 exit -1 |
| 219 fi |
| 328 fi | 220 fi |
| 329 | 221 |
| 330 local rev=$(get-revision) | 222 StepBanner "final-commit" "Committing pnacl-sfi branch" |
| 223 hg-commit "${TC_SRC_UPSTREAM}" "Merged up to r${MERGE_REVISION}" |
| 331 | 224 |
| 332 StepBanner "final-commit - Committing hg pnacl-sfi branch (llvm)" | 225 StepBanner "final-commit" "Pushing to hg/upstream" |
| 333 hg-commit "${TC_SRC_LLVM}" "Merged up to r${rev}" | 226 hg-push "${TC_SRC_UPSTREAM}" |
| 334 | |
| 335 StepBanner "final-commit - Committing hg pnacl-sfi branch (llvm-gcc)" | |
| 336 hg-commit "${TC_SRC_LLVM_GCC}" "Merged up to r${rev}" | |
| 337 | |
| 338 StepBanner "final-commit - Pushing (llvm)" | |
| 339 hg-push "${TC_SRC_LLVM}" | |
| 340 | |
| 341 StepBanner "final-commit - Pushing (llvm-gcc)" | |
| 342 hg-push "${TC_SRC_LLVM_GCC}" | |
| 343 } | |
| 344 | |
| 345 #+ hg-status-check <name> <repo> - Allow the user to check hg status for probl
ems | |
| 346 hg-status-check() { | |
| 347 local name="$1" | |
| 348 local repo="$2" | |
| 349 spushd "${repo}" | |
| 350 ( | |
| 351 echo "Please verify hg status for ${name}:" | |
| 352 echo "Hit q to exit 'less'" | |
| 353 echo "---------------------------------------------------" | |
| 354 hg status | |
| 355 echo "---------------------------------------------------" | |
| 356 ) 2>&1 | less | |
| 357 spopd | |
| 358 | |
| 359 if ! confirm-yes "Does the status for ${name} look correct"; then | |
| 360 echo "Cancelling vendor update." | |
| 361 echo "hg repositories remain in uncommitted state." | |
| 362 echo "Use 'tools/llvm/merge-tool.sh clean' to clean them" | |
| 363 exit -1 | |
| 364 fi | |
| 365 } | 227 } |
| 366 | 228 |
| 367 #@ help - Usage information. | 229 #@ help - Usage information. |
| 368 help() { | 230 help() { |
| 369 Usage | 231 Usage |
| 370 } | 232 } |
| 371 | 233 |
| 372 [ $# = 0 ] && set -- help # Avoid reference to undefined $1. | 234 [ $# = 0 ] && set -- help # Avoid reference to undefined $1. |
| 373 if [ "$(type -t $1)" != "function" ]; then | 235 if [ "$(type -t $1)" != "function" ]; then |
| 374 echo "ERROR: unknown function '$1'." >&2 | 236 echo "ERROR: unknown function '$1'." >&2 |
| 375 echo "For help, try:" | 237 echo "For help, try:" |
| 376 echo " $0 help" | 238 echo " $0 help" |
| 377 exit 1 | 239 exit 1 |
| 378 fi | 240 fi |
| 379 | 241 |
| 242 check-svn-repos |
| 380 "$@" | 243 "$@" |
| OLD | NEW |