From 627fcfb530c25c5ca05be55042bdc841d7f27aa4 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Thu, 2 Jan 2014 09:42:52 -0500 Subject: Added ChangeLog revision hyperlinking to html-gen.sh --- ChangeLog | 5 +++++ html-gen.sh | 35 +++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6a1c5e..0640d4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-01-02 Andrew Azores + + Added ChangeLog revision hyperlinking to html-gen.sh + * html-gen.sh: ChangeLog dates made hyperlinks to corresponding commits + 2013-12-27 Andrew Azores Resolve deadlock issue in JNLPClassLoader. See diff --git a/html-gen.sh b/html-gen.sh index 5502f89..535a834 100755 --- a/html-gen.sh +++ b/html-gen.sh @@ -45,24 +45,35 @@ # same directory as this script. These generated HTML documents are then used # in the netx About Dialog, which can be invoked with "javaws -about". -# Currently the script is not configurable in any way and the files it processes +# The only configuration option is the number of Changesets, and the files processed # are hardcoded. To run the script manually, create a directory "html-gen" in the # same directory as this script, containing files named AUTHORS, NEWS, ChangeLog, # and COPYING. Note that these files WILL be modified in-place during the HTML # "conversion" process. Setting the environment variable "HTML_GEN_DEBUG" to "true" # will enable some output from the script, which may be useful if you encounter # issues with this script's processing of an input file. - -if [ -z "$HTML_GEN_DEBUG" ]; then HTML_GEN_DEBUG="false"; fi +# The number of Changesets to process into the ChangeLog can be set by setting the +# environment variable HTML_GEN_CHANGESETS, or by passing an integer argument to +# the script. The parameter will take priority over the environment variable. print_debug() { - if [ "$HTML_GEN_DEBUG" == "true" ]; then echo "$1"; fi + if [ "$HTML_GEN_DEBUG" ]; then echo "$1"; fi } +CHANGESETS="$1" + +if [ -z "$CHANGESETS" ]; then CHANGESETS="$HTML_GEN_CHANGESETS"; fi + +if [ -z "$CHANGESETS" ] || [ "$CHANGESETS" -lt 0 ]; then CHANGESETS=10; fi + +NEWS_ITEMS=2 +REPO_URL="$(hg paths default | sed -r 's/.*icedtea.classpath.org\/(.*)/\1/')" + start_time=$(date +%s.%N) cd html-gen +print_debug "Generating HTML content for javaws -about for $REPO_URL. $CHANGESETS changesets, $NEWS_ITEMS news items" print_debug "Starting sed substitutions" for FILE in NEWS AUTHORS COPYING ChangeLog do @@ -88,6 +99,8 @@ sed -i '4i
' AUTHORS.html sed -i '5i
Jam Icon

' AUTHORS.html echo "
" >> AUTHORS.html +REVS=(`hg log -l$CHANGESETS | grep 'changeset:' | cut -d: -f3 | tr '\n' ' '`) + print_debug "Done. Starting formatting (bolding, mailto and hyperlink creation)" for FILE in NEWS.html ChangeLog.html @@ -105,20 +118,26 @@ do BOLD=0 COUNTER=$(( $COUNTER + 1 )) fi - if [[ $COUNTER -gt 2 ]] # Cut to two releases + if [[ $COUNTER -gt $NEWS_ITEMS ]] # Cut to two releases then break fi else - if [[ $LINE =~ .*\<\;.*\@.*\>\; ]] # Matches eg , after HTML-escaping + email_regex=".*\<.*\@.*\>" + if [[ $LINE =~ $email_regex ]] # Matches eg , after HTML-escaping then BOLD=0 fi - if [[ $LINE =~ [0-9]{4}-[0-9]{2}-[0-9]{2}* ]] # Matches eg 2013-07-01 + date_regex="[0-9]{4}-[0-9]{2}-[0-9]{2}" + if [[ $LINE =~ $date_regex* ]] # Matches line starting with eg 2013-07-01 then + html_space="\ \ " + REV=${REVS[$COUNTER]} + # Turn the date into a hyperlink for the revision this changelog entry describes + LINE=$(echo "$LINE" | sed -r "s|($date_regex)($html_space.*$html_space.*)|\1\2|") COUNTER=$(( $COUNTER + 1 )) fi - if [[ $COUNTER -gt 10 ]] # Cut to ten changesets + if [[ $COUNTER -gt $CHANGESETS ]] # Cut to ten changesets then break fi -- cgit v1.2.3