Chromium Code Reviews| Index: update_google_patch.sh |
| diff --git a/update_google_patch.sh b/update_google_patch.sh |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..bcff469dc43928e1578e4ca8072a10fa9c569fa5 |
| --- /dev/null |
| +++ b/update_google_patch.sh |
| @@ -0,0 +1,91 @@ |
| +#!/bin/bash |
| + |
| +# Copyright (c) 2014 The Chromium Authors. All rights reserved. |
|
brettw
2014/05/29 17:06:17
Remove the "(c)"
(see http://www.chromium.org/dev
groby-ooo-7-16
2014/05/29 17:37:48
Done.
|
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +# Creates an updated google.patch that reflects all checked-in changes in the |
|
brettw
2014/05/29 17:06:17
Got two spaces after "in"
Can this list some more
groby-ooo-7-16
2014/05/29 17:37:48
Done. (Two spaces after in - comment discussion mo
|
| +# current branch. |
| +cvs_dir="" |
| + |
| +tempfiles=( ) |
| +tmplate="/tmp/`basename $0`.XXXXXX" |
| + |
| +function cleanup() { |
| + if [[ $cvs_dir ]]; then |
| + rm -r "${cvs_dir}" |
| + fi |
| + |
| + if [[ ${tempfiles[@]} ]]; then |
| + rm "${tempfiles[@]}" |
| + fi |
| + cd ${starting_dir} |
| +} |
| + |
| +trap cleanup 0 |
| + |
| +# Generate a temp file and register it for cleanup |
| +function tempfile() { |
| + local result=$1 |
| + local tmpfile=$(mktemp ${tmplate}) || exit 1 |
| + tempfiles+=( "${tmpfile}" ) |
| + eval $result="'$tmpfile'" |
| +} |
| + |
| +starting_dir=$(pwd) |
| +hunspell_dir=$(dirname $(readlink -e $0)) |
| +tempfile filter_file |
| + |
| +# Temp file with a list of all excluded files |
| +cat << EOF > ${filter_file} |
| +google.patch |
| +update_google_patch.sh |
| +README.chromium |
| +EOF |
| + |
| +# List of all files changed relative to upstream |
| +changed_files=$(git --no-pager diff @{u} --name-status | grep -vf ${filter_file} ) |
| + |
| +# Check we don't actually have files that are added or deleted, because |
| +# that can't be handled by the read-only CVS checkout. |
| +added_files=$( echo "${changed_files}" | grep "^A") |
| +if [[ ${added_files} ]] ; then |
| + echo "Script cannot handle added files" |
| + exit 1 |
| +fi |
| +deleted_files=$( echo "${changed_files}" | grep "^D") |
| +if [[ ${deleted_files} ]] ; then |
| + echo "Script cannot handle deleted files" |
| + exit 1 |
| +fi |
| + |
| +# Generate patch between branch point and current status. |
| +diff_files=$( echo "${changed_files}" | grep "^M" | cut -f1 --complement ) |
| +tempfile local_patch_file |
| +echo "${diff_files}" | xargs -IXX git --no-pager diff --no-prefix @{u} -- XX > ${local_patch_file} |
| + |
| +# Create copy of google.patch at branch point version. |
| +tempfile google_patch_file |
| +git show @{u}:google.patch > ${google_patch_file} |
| + |
| +# Create a temporary checkout for hunspell |
| +cvs_dir=$(mktemp -d ${tmplate}) || exit 1 |
| + |
| +# Get hunspell |
| +cd ${cvs_dir} |
| +echo Checking out CVS version. |
| +cvs -z3 \ |
| + -qd:pserver:anonymous@hunspell.cvs.sourceforge.net:/cvsroot/hunspell \ |
| + co -D "23 Mar 2012" -P hunspell |
| + |
| +# Apply both google.patch and changes in the current branch |
| +cd hunspell |
| +echo Applying google.patch. |
| +patch -p0 -i ${google_patch_file} |
| +echo Applying local patch. |
| +patch -p0 -i ${local_patch_file} |
| + |
| +# And generate a new google.patch |
| +echo Updating google.patch. |
| +cvs -q diff -u > ${hunspell_dir}/google.patch |
| + |