#959 - Added Bash scripts to update the copyright years of Java source files.
Usage is described by executing the scripts without parameters.
This commit is contained in:
27
etc/scripts/branch-update-license-headers
Executable file
27
etc/scripts/branch-update-license-headers
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script updates the license headers of Java files to extend the copyright year to given date and commits those using the given message to all branches listed
|
||||
USAGE="$0 <year> <commit message> <branches...>"
|
||||
if [ $# -lt 1 ]; then echo -e "ERROR: Year required. \n$USAGE" >&2; exit 1; fi
|
||||
if [ $# -lt 2 ]; then echo -e "ERROR: Commit message required.\n$USAGE" >&2; exit 1; fi
|
||||
if [ $# -lt 3 ]; then echo -e "ERROR: At least one branch required.\n$USAGE" >&2; exit 1; fi
|
||||
|
||||
YEAR="$1"
|
||||
MESSAGE="$2"
|
||||
shift 2
|
||||
|
||||
git fetch
|
||||
|
||||
PUSHSPEC=""
|
||||
for branch in "$@"
|
||||
do
|
||||
echo "Processing branch $branch"
|
||||
git checkout $branch
|
||||
git rebase origin/$branch
|
||||
update-license-headers.sh $YEAR
|
||||
git add *.java
|
||||
git commit -m "$MESSAGE"
|
||||
PUSHSPEC="${PUSHSPEC} $branch"
|
||||
done
|
||||
|
||||
echo pushing $PUSHSPEC
|
||||
@@ -3,7 +3,7 @@
|
||||
# This script creates a new local issue branch for the given issue id.
|
||||
# Previous changes are stashed before the issue branch is created and are reapplied after branch creation.
|
||||
#
|
||||
# executing new-issue-branch.sh DATACMNS-42
|
||||
# executing new-issue-branch DATACMNS-42
|
||||
# will create a new (local) branch issue/DATACMNS-42
|
||||
USAGE="$0 <ticket_id>"
|
||||
if [ $# -lt 1 ]; then echo -e "ERROR: ticket_id required. \n$USAGE" >&2; exit 1; fi
|
||||
|
||||
9
etc/scripts/update-license-headers
Executable file
9
etc/scripts/update-license-headers
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script updates the license headers of all Java files to extend the copyright year to the given date.
|
||||
USAGE="$0 <year>"
|
||||
if [ $# -lt 1 ]; then echo -e "ERROR: Year required. \n$USAGE" >&2; exit 1; fi
|
||||
|
||||
YEAR=$1
|
||||
for file in `find . -name '*.java' `; do sed -E -i '' "s/\* Copyright ([0-9]{4})-([0-9]{4}) the/\* Copyright \1-${YEAR} the/g" $file; done
|
||||
for file in `find . -name '*.java' `; do sed -E -i '' "s/\* Copyright ([0-9]{4}) the/\* Copyright \1-${YEAR} the/g" $file; done
|
||||
Reference in New Issue
Block a user