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