278N/A# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 278N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 278N/A# This code is free software; you can redistribute it and/or modify it 278N/A# under the terms of the GNU General Public License version 2 only, as 278N/A# published by the Free Software Foundation. 278N/A# This code is distributed in the hope that it will be useful, but WITHOUT 278N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 278N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 278N/A# version 2 for more details (a copy is included in the LICENSE file that 278N/A# accompanied this code). 278N/A# You should have received a copy of the GNU General Public License version 278N/A# 2 along with this work; if not, write to the Free Software Foundation, 278N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 278N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 278N/A# Script to update the Copyright YEAR range in Mercurial sources. 278N/A# (Originally from xdono, Thanks!) 278N/A# This year or supplied year 278N/Aif [
"$1" !=
"" ] ;
then 278N/A# Return true if it makes sense to edit this file 278N/A if [ "$1" != "" -a -f $1 ] ; then 278N/A if [ "${isText}" != "" \ 278N/A -a "${hasCopyright}" != "" \ 278N/A# Update the copyright year on a file 278N/A sed -e "s@\(${copyright} [12][0-9][0-9][0-9],\) [12][0-9][0-9][0-9], ${company}@\1 ${year}, ${company}@" | \ 278N/A sed -e "s@\(${copyright} [12][0-9][0-9][0-9],\) ${company}@\1 ${year}, ${company}@" | \ 278N/A sed -e "s@${copyright} ${year}, ${year}, ${company}@${copyright} ${year}, ${company}@" \ 278N/A# Update the copyright year on all files changed by this changeset 278N/A | ${awk} -F' ' '{for(i=1;i<=NF;i++)print $i}' \ 278N/A if [ -f "${files}" -a -s "${files}" ] ; then 278N/A printf " ERROR: No files changed in the changeset? Must be a mistake.\n" 278N/A | ${awk} -F' ' '{for(i=1;i<=NF;i++)print $i}' 278N/A# Check if repository is clean 278N/A echo "WARNING: This repository contains previously edited working set files." 278N/A# Get all changesets this year 278N/A# Check changeset to see if it is Copyright only changes, filter changesets 278N/A echo "------------------------------------------------" 328N/A if [
"${year}" =
"2010" ] ;
then 278N/A echo "---------------------------------------------" 278N/A echo "Updated the copyright year on a total of ${total} files." 278N/A echo "This count should match the count of modified files in the repository: hg status -m" 278N/A echo "WARNING: This repository contained previously edited working set files." 278N/A echo "---------------------------------------------" 278N/A echo "No files were changed" 278N/A echo "WARNING: This repository contained previously edited working set files."