| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 2 # Copyright 2014 Google Inc. | |
| 3 # | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 # Syncs //depot/google3/third_party/skia/HEAD to the latest revision of Skia. | |
| 8 # If this script is not run from a Piper client, creates a new CitC client. Also | |
| 9 # updates README.google. | |
| 10 # | |
| 11 # Usage: | |
| 12 # ./tools/sync_google3.sh | |
| 13 | |
| 14 prodcertstatus -q || (echo "Please run prodaccess." 1>&2; exit 1) | |
| 15 source gbash.sh || exit 2 | |
| 16 | |
| 17 set -e | |
| 18 | |
| 19 MY_DIR="$(gbash::get_absolute_caller_dir)" | |
| 20 SKIA_REV="$(git ls-remote https://skia.googlesource.com/skia refs/heads/master |
cut -f 1)" | |
| 21 | |
| 22 gbash::get_google3_dir && GOOGLE3="$(gbash::get_google3_dir)" | |
| 23 if [ -z "${GOOGLE3}" ]; then | |
| 24 CLIENT_NAME="sync_skia_$(date '+%F-%H-%M-%S')" | |
| 25 ${MY_DIR}/create_skia_google3_client.sh "${CLIENT_NAME}" | |
| 26 GOOGLE3="/google/src/cloud/${USER}/${CLIENT_NAME}/google3" | |
| 27 fi | |
| 28 cd "${GOOGLE3}/third_party/skia/HEAD" | |
| 29 ${MY_DIR}/git_clone_to_google3.sh --skia_rev "${SKIA_REV}" | |
| 30 | |
| 31 echo "Synced client ${CLIENT_NAME} to ${SKIA_REV}" | |
| 32 | |
| 33 # Grab previous Git revision. | |
| 34 GOOGLE3_REV="$(grep "Version: " README.google | cut -d ' ' -f 2)" | |
| 35 | |
| 36 # Update README.google. | |
| 37 sed --in-place "s/^Version: .*/Version: ${SKIA_REV}/" README.google | |
| 38 sed --in-place "s/URL: https:\/\/skia.googlesource.com\/skia\/+archive\/.*\.tar\
.gz/URL: https:\/\/skia.googlesource.com\/skia\/+archive\/${SKIA_REV}.tar.gz/" R
EADME.google | |
| 39 | |
| 40 # Add README.google to the default change. | |
| 41 g4 reopen | |
| 42 | |
| 43 # Generate commit description. | |
| 44 CURRENT_DATE=`date '+%d %B %Y'` | |
| 45 COMMIT_RANGE="${GOOGLE3_REV:0:9}..${SKIA_REV:0:9}" | |
| 46 CHANGES="$(git log ${COMMIT_RANGE} --date=short --no-merges --format='%ad %ae %s
')" | |
| 47 COMMITS="$(wc -l <<EOF | |
| 48 ${CHANGES} | |
| 49 EOF | |
| 50 )" | |
| 51 DESC="$(cat <<EOF | |
| 52 Roll Skia ${COMMIT_RANGE} (${COMMITS} commits) | |
| 53 | |
| 54 https://chromium.googlesource.com/skia.git/+log/${COMMIT_RANGE} | |
| 55 | |
| 56 $ git log ${COMMIT_RANGE} --date=short --no-merges --format='%ad %ae %s' | |
| 57 ${CHANGES} | |
| 58 | |
| 59 Change created by sync_google3.sh on ${CURRENT_DATE} by ${USER} | |
| 60 EOF | |
| 61 )" | |
| 62 | |
| 63 # Create a new CL. | |
| 64 CHANGE="$(g4 change --desc "${DESC}.")" | |
| 65 CL="$(echo "${CHANGE}" | sed "s/Change \([0-9]\+\) created.*/\1/")" | |
| 66 | |
| 67 echo "Created CL ${CL} (http://cl/${CL})" | |
| 68 | |
| 69 # Run presubmit (will run TAP tests). | |
| 70 if g4 presubmit -c "${CL}"; then | |
| 71 echo "CL is ready for review and submit at http://cl/${CL}" | |
| 72 else | |
| 73 echo "Presubmit failed for CL ${CL} in client ${CLIENT_NAME}" 1>&2 | |
| 74 exit 3 | |
| 75 fi | |
| OLD | NEW |