tags 350133 + patch thanks On Fri, 2006-10-20 at 14:20 -0500, Peter Samuelson wrote: > [Arthur de Jong] > > Is there any news in including svn2cl in the subversion-tools > > package? Subversion 1.4.0 ships with svn2cl 0.7 and is available in > > the source tarball. > > Oh - thanks for the reminder. I definitely intended to ship that, just > kept forgetting to do so. I don't think it's too late for etch, as I'm > hoping for one more subversion upload after the apache 2.2 thing goes > through, so I'll try to make sure svn2cl is in that.
Attached is a patch that should include svn2cl in the subversion-tools package. Some quick tests indicate that it is working as expected. > (I'm wanting to get 1.4.1 in before etch, but that depends on when > 1.4.1 is released. Otherwise I'll apply a patch to bring our 1.4.0 up > to the current branches/1.4.x.) > > Do you think it is worthwhile to ship svn2cl 0.8 from trunk? I mean, > will that work with 1.4? Or should I stay with version 0.7? svn2cl should work with any version of svn (as long as the xml format does not drastically change). There is one extra feature svn2cl that it will use if used with svn >= 1.3 bot other than that I'm not aware of any compatibility issues. svn2cl 0.8 fixes some small bugs that were present in 0.7 though. 0.8 is generally "better". Attached is also a patch to upgrade svn2cl to 0.8 plus a fix to the manual page (thanks to lintian). -- -- arthur - [EMAIL PROTECTED] - http://people.debian.org/~adejong --
diff -Naur subversion-1.4.0.orig/debian/changelog subversion-1.4.0/debian/changelog --- subversion-1.4.0.orig/debian/changelog 2006-10-21 02:16:03.000000000 +0200 +++ subversion-1.4.0/debian/changelog 2006-10-21 01:31:45.000000000 +0200 @@ -1,3 +1,9 @@ +subversion (1.4.0-5.1) unstable; urgency=low + + * install svn2cl in subversion-tools + + -- Arthur de Jong <[EMAIL PROTECTED]> Sat, 21 Oct 2006 01:31:17 +0200 + subversion (1.4.0-5) unstable; urgency=medium [ Peter Samuelson ] diff -Naur subversion-1.4.0.orig/debian/control subversion-1.4.0/debian/control --- subversion-1.4.0.orig/debian/control 2006-10-21 02:16:03.000000000 +0200 +++ subversion-1.4.0/debian/control 2006-10-21 01:32:26.000000000 +0200 @@ -96,7 +96,7 @@ Priority: extra Architecture: all Depends: python-subversion (>= 1.4), subversion (>= 1.4), python, perl (>= 5.8.0-7), liburi-perl (>= 1.17-1), libconfig-inifiles-perl (>= 2.27-1) -Recommends: rcs, exim4 | mail-transport-agent +Recommends: rcs, exim4 | mail-transport-agent, xsltproc Description: Assorted tools related to Subversion This package includes miscellaneous tools for use with Subversion clients and servers. See the 'subversion' package for more diff -Naur subversion-1.4.0.orig/debian/rules subversion-1.4.0/debian/rules --- subversion-1.4.0.orig/debian/rules 2006-10-21 02:16:03.000000000 +0200 +++ subversion-1.4.0/debian/rules 2006-10-21 17:44:47.000000000 +0200 @@ -241,6 +241,13 @@ rm debian/subversion-tools/usr/share/subversion/hook-scripts/*.in rm -r debian/subversion-tools/usr/share/subversion/hook-scripts/mailer/tests + install contrib/client-side/svn2cl/README \ + debian/subversion-tools/usr/share/doc/subversion-tools/README.svn2cl + install contrib/client-side/svn2cl/NEWS \ + debian/subversion-tools/usr/share/doc/subversion-tools/NEWS.svn2cl + chmod 755 debian/subversion-tools/usr/share/svn2cl/svn2cl.sh + dh_link -psubversion-tools usr/share/svn2cl/svn2cl.sh usr/bin/svn2cl + # Fix some scripts not to use #!/usr/bin/env. dest=debian/subversion-tools/usr/share/subversion/hook-scripts; \ for file in commit-email.pl \ diff -Naur subversion-1.4.0.orig/debian/subversion-tools.dirs subversion-1.4.0/debian/subversion-tools.dirs --- subversion-1.4.0.orig/debian/subversion-tools.dirs 2006-10-21 02:16:03.000000000 +0200 +++ subversion-1.4.0/debian/subversion-tools.dirs 2006-10-21 20:03:24.000000000 +0200 @@ -1,3 +1,4 @@ usr/bin usr/share/doc/subversion-tools usr/share/doc/subversion/examples +usr/share/svn2cl diff -Naur subversion-1.4.0.orig/debian/subversion-tools.examples subversion-1.4.0/debian/subversion-tools.examples --- subversion-1.4.0.orig/debian/subversion-tools.examples 1970-01-01 01:00:00.000000000 +0100 +++ subversion-1.4.0/debian/subversion-tools.examples 2006-10-21 01:22:06.000000000 +0200 @@ -0,0 +1,2 @@ +contrib/client-side/svn2cl/svn2html.css +contrib/client-side/svn2cl/authors.xml diff -Naur subversion-1.4.0.orig/debian/subversion-tools.install subversion-1.4.0/debian/subversion-tools.install --- subversion-1.4.0.orig/debian/subversion-tools.install 2006-10-21 02:16:03.000000000 +0200 +++ subversion-1.4.0/debian/subversion-tools.install 2006-10-21 13:49:08.000000000 +0200 @@ -1,2 +1,6 @@ tools/hook-scripts/* usr/share/subversion/hook-scripts BUILD/tools/hook-scripts/* usr/share/subversion/hook-scripts + +contrib/client-side/svn2cl/svn2cl.sh usr/share/svn2cl +contrib/client-side/svn2cl/svn2cl.xsl usr/share/svn2cl +contrib/client-side/svn2cl/svn2html.xsl usr/share/svn2cl diff -Naur subversion-1.4.0.orig/debian/subversion-tools.manpages subversion-1.4.0/debian/subversion-tools.manpages --- subversion-1.4.0.orig/debian/subversion-tools.manpages 2006-10-21 02:16:03.000000000 +0200 +++ subversion-1.4.0/debian/subversion-tools.manpages 2006-10-21 01:25:23.000000000 +0200 @@ -1,2 +1,3 @@ debian/man/svn_load_dirs.1 debian/man/svnwrap.1 +contrib/client-side/svn2cl/svn2cl.1
diff -Naur a/contrib/client-side/svn2cl/authors.xml b/contrib/client-side/svn2cl/authors.xml --- a/contrib/client-side/svn2cl/authors.xml 2006-03-27 22:19:03.000000000 +0200 +++ b/contrib/client-side/svn2cl/authors.xml 2006-10-22 01:08:22.000000000 +0200 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<authors> +<authors xmlns:html="http://www.w3.org/1999/xhtml"> <author uid="arthur"> - Arthur de Jong <[EMAIL PROTECTED]> + Arthur de Jong <<html:a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</html:a>> </author> <author uid="nobody"> Who's this <[EMAIL PROTECTED]> diff -Naur a/contrib/client-side/svn2cl/NEWS b/contrib/client-side/svn2cl/NEWS --- a/contrib/client-side/svn2cl/NEWS 2006-04-10 23:39:45.000000000 +0200 +++ b/contrib/client-side/svn2cl/NEWS 2006-10-22 01:08:30.000000000 +0200 @@ -1,3 +1,19 @@ +changes from 0.7 to 0.8 +----------------------- + +* added --title option for setting html page title (thanks Matt Doar) +* added --revision-link option to make the revision numbers in the html + output link to some url +* updated --break-before option to have an optional number of breaks +* authors file format improvements (see manual) +* fixes to the svn info command to guess working directory (thanks Iwasa + Kazmi) +* miscellaneous fixes (thanks Max Bane and Iwasa Kazmi) +* document calling svn2cl from ant by Rob Moore +* some wrapping fixes +* fixes for having directories and/or repositories with spaces in them + + changes from 0.6 to 0.7 ----------------------- diff -Naur a/contrib/client-side/svn2cl/README b/contrib/client-side/svn2cl/README --- a/contrib/client-side/svn2cl/README 2006-04-10 23:39:45.000000000 +0200 +++ b/contrib/client-side/svn2cl/README 2006-10-22 01:08:30.000000000 +0200 @@ -31,10 +31,10 @@ INTRODUCTION ============ -svn2cl is a simple xsl transformation and shellscript wrapper for generating a -classic GNU-style ChangeLog from a subversion repository log. It is made from -several changelog-like scripts using common xslt constructs found in different -places. +svn2cl is a simple xsl transformation and shell script wrapper for generating +a classic GNU-style ChangeLog from a subversion repository log. It is made +from several changelog-like scripts using common xslt constructs found in +different places. I made it because it was the only thing that I missed from cvs after I converted a repository to subversion. I used cvs2cl before. @@ -42,13 +42,48 @@ INSTALLING SVN2CL ================= -Just unpack the tarball in some directory (e.g. /opt/svn2cl-0.7) +Just unpack the tarball in some directory (e.g. /opt/svn2cl-0.8) and symlink the svn2cl.sh script in your path somewhere (e.g. -ln -s /opt/svn2cl-0.7/svn2cl.sh /usr/local/bin/svn2cl). +ln -s /opt/svn2cl-0.8/svn2cl.sh /usr/local/bin/svn2cl). Note: Be sure to keep the svn2cl.xsl file in the same directory as the svn2cl.sh script as the script looks for it there (symlinking is ok). +USING SVN2CL IN AN ANT TARGET +============================= + +It is possible to use svn2cl in an ant target with a snippet like: + +<tempfile property="info.xml.file" + prefix="info-" suffix=".xml" + destdir="${java.io.tmpdir}" /> +<java classname="org.tmatesoft.svn.cli.SVN" dir="${basedir}" + fork="true" output="${info.xml.file}" + classpathref="javasvn-classpath"> + <arg line="log --xml --verbose" /> +</java> +<xslt in="${info.xml.file}" out="ChangeLog" style="svn2cl.xsl"> + <param name="strip-prefix" expression="trunk/myProject/" /> + <param name="groupbyday" expression="yes" /> + <param name="separate-daylogs" expression="yes" /> + <param name="include-rev" expression="yes" /> + <param name="breakbeforemsg" expression="yes" /> + <param name="reparagraph" expression="yes" /> +</xslt> +<delete file="${info.xml.file}" /> + +Although it seems that currently the xslt processor that is used by ant +inserts newlines in places it shouldn't. This can be worked around by +replacing &newl; throughout the xsl files by 
. + +WINDOWS PORT +============ + +A VBScript port of the wrapper shell script has been made by Iwasa Kazmi, +which allows running svn2cl on Microsoft Windows without a POSIX compatibility +layer and xsltproc. More information is available here: +http://www.cosmo-system.jp/iwasa/svn2clwin.html + NOTES ===== diff -Naur a/contrib/client-side/svn2cl/svn2cl.1 b/contrib/client-side/svn2cl/svn2cl.1 --- a/contrib/client-side/svn2cl/svn2cl.1 2006-04-10 23:39:45.000000000 +0200 +++ b/contrib/client-side/svn2cl/svn2cl.1 2006-10-22 01:08:22.000000000 +0200 @@ -24,7 +24,7 @@ .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.TH "svn2cl" "1" "Apr 2006" "Version 0.7" "User Commands" +.TH "svn2cl" "1" "Sep 2006" "Version 0.8" "User Commands" .nh .SH "NAME" svn2cl \- Create a ChangeLog from a subversion log. @@ -34,7 +34,7 @@ .RI [ PATH ]... .SH "DESCRIPTION" -\fBsvn2cl\fP generates a classic GNU-style ChangeLog from the log messages in a subversion repository. +\fBsvn2cl\fP generates a classic GNU\-style ChangeLog from the log messages in a subversion repository. It acts as a wrapper around the `\fBsvn log\fP' command, parsing the XML output with an XSLT stylesheet. Alternatively it can generate HTML output intended for use with the \fBsvn2html.css\fP style sheet that comes with \fBsvn2cl\fP. @@ -69,18 +69,31 @@ If the \-\-html option is specified this is implied, edit \fBsvn2html.css\fP to turn it off. .TP -\fB\-\-break-before-msg\fR -Add a line break between the log paths and the log message. -If the \-\-html option is specified this is implied, edit \fBsvn2html.css\fP to turn it off. +\fB\-\-break\-before\-msg\fR[=\fINUM\fR] +Add a line break (or multiple line breadks) between the paths and the log message. +If the \-\-html option is specified this option is ignored, edit \fBsvn2html.css\fP to set spacing. .TP \fB\-\-reparagraph\fR -Newlines inside paragraphs are ignored and paragraphs are re-wrapped. +Newlines inside paragraphs are ignored and paragraphs are re\-wrapped. Paragraphs are separated by empty lines. .TP +\fB\-\-title\fR=\fINAME\fR +If outputting an HTML file the \fINAME\fR is used as the title. +This option is ignored for normal text output. + +.TP +\fB\-\-revision\-link\fR=\fINAME\fR +This option is used to generate links from the revision numbers in the generated HTML file. +If \fINAME\fR contains two hashes `\fB##\fP' that part will be replaced by the revision number, otherwise the revision number will be appended to \fINAME\fR. +Only the first occurrence of `\fB##\fP' will be replaced. +.br +This option is ignored for normal text output. + +.TP \fB\-o\fR, \fB\-f\fR, \fB\-\-output\fR=\fIFILE\fR, \fB\-\-file\fR=\fIFILE\fR -Output ChangeLog to \fIFILE\fR instead of the default \fBChangeLog\fP (or \fBChangeLog.html\fP for html output). +Output ChangeLog to \fIFILE\fR instead of the default \fBChangeLog\fP (or \fBChangeLog.html\fP for HTML output). .TP \fB\-\-stdout\fR @@ -89,28 +102,15 @@ .TP \fB\-\-authors\fR=\fIFILE\fR The \fIFILE\fR is used to map author names as exported by svn to full names. -An author file should look something like: -.ft B - <?xml version="1.0" encoding="utf-8"?> - <authors> - <author uid="arthur"> - Arthur de Jong <[EMAIL PROTECTED]> - </author> - </authors> -.ft R +See the section on AUTHORS FILES below for more information. .br -As a bonus an authors file that looks like the following is internally converted to the xml represantation: -.ft B - arthur:Arthur de Jong <[EMAIL PROTECTED]> -.ft R -.br -Note that the \-\-authors option has pretty poor performance at the moment. +Note that the \-\-authors option can have poor performance in some cases. .TP \fB\-\-html\fR -Generate an html file containing a ChangeLog instead of the default text ChangeLog file. +Generate an HTML file containing a ChangeLog instead of the default text ChangeLog file. This feature is still experimental. -The \fBsvn2html.css\fP file that is included in the distribution can be used to format the html. +The \fBsvn2html.css\fP file that is included in the distribution can be used to format the HTML. .TP \fB\-h\fR, \fB\-\-help\fR @@ -126,6 +126,39 @@ .br See `\fBsvn help log\fP' for more information on these options. +.SH "AUTHORS FILES" + +An authors file is basically an XML file that should look something like: +.ft B + <?xml version="1.0" encoding="utf\-8"?> + <authors> + <author uid="arthur"> + Arthur de Jong <[EMAIL PROTECTED]> + </author> + </authors> +.ft R +.br +svn2cl searches for <author> tags with the specified uid attribute. +The content from the author tag is substituted for the author name. + +The <author> tag may also contain XML child tags which can be useful for embedding HTML into the result. +For this to work namespace information should be included for HTML output: +.ft B + <?xml version="1.0" encoding="utf\-8"?> + <authors xmlns:html="http://www.w3.org/1999/xhtml"> + <author uid="arthur"> + Arthur de Jong <<html:b>[EMAIL PROTECTED]</html:b>> + </author> + </authors> +.ft R +.br +The svn2cl distribution contains a sample authors.xml file. + +As a bonus a plain text authors file that looks like the following is automatically converted to the XML representation: +.ft B + arthur:Arthur de Jong <[EMAIL PROTECTED]> +.ft R + .SH "EXAMPLES" Run svn log recursively on the current directory and generate a text ChangeLog file in the current directory for the entire log history: @@ -135,7 +168,7 @@ Output the changes from the last week, while including revision numbers in the ChangeLog: .ft B - svn2cl \-i \-r "HEAD:{`date -d '7 days ago' '+%F %T'`}" + svn2cl \-i \-r "HEAD:{`date \-d '7 days ago' '+%F %T'`}" .ft R .br (actually subversion will include the first revision before the specified period) diff -Naur a/contrib/client-side/svn2cl/svn2cl.sh b/contrib/client-side/svn2cl/svn2cl.sh --- a/contrib/client-side/svn2cl/svn2cl.sh 2006-04-10 23:39:45.000000000 +0200 +++ b/contrib/client-side/svn2cl/svn2cl.sh 2006-10-22 01:08:22.000000000 +0200 @@ -36,7 +36,7 @@ set -u # svn2cl version -VERSION="0.7" +VERSION="0.8" # set default parameters PWD=`pwd` @@ -49,10 +49,12 @@ SEPARATEDAYLOGS="no" CHANGELOG="" OUTSTYLE="cl" -SVNCMD="svn --verbose --xml log" +SVNLOGCMD="svn --verbose --xml log" +SVNINFOCMD="svn info" AUTHORSFILE="" +TITLE="ChangeLog" +REVISION_LINK="#r" TMPFILES="" -PATHS="" # do command line checking prog=`basename $0` @@ -87,14 +89,35 @@ INCLUDEREV="yes"; shift ;; - --break-before-msg) + --break-before-msg|--breaks-before-msg) + # FIXME: if next argument is numeric use that as a parameter BREAKBEFOREMSG="yes" shift ;; + --break-before-msg=*|--breaks-before-msg=*) + BREAKBEFOREMSG=`echo "$1" | sed 's/^--[a-z-]*=//'` + shift + ;; --reparagraph) REPARAGRAPH="yes" shift ;; + --title) + TITLE="$2" + shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; } + ;; + --title=*) + TITLE=`echo "$1" | sed 's/^--[a-z-]*=//'` + shift + ;; + --revision-link) + REVISION_LINK="$2" + shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; } + ;; + --revision-link=*) + REVISION_LINK=`echo "$1" | sed 's/^--[a-z-]*=//'` + shift + ;; -f|--file|-o|--output) CHANGELOG="$2" shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; } @@ -119,21 +142,44 @@ OUTSTYLE="html" shift ;; - -r|--revision|--targets|--username|--password|--config-dir|--limit) + -r|--revision|--targets|--limit) # add these as extra options to the command (with argument) arg=`echo "$2" | sed "s/'/'\"'\"'/g"` - SVNCMD="$SVNCMD $1 '$arg'" + SVNLOGCMD="$SVNLOGCMD $1 '$arg'" shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; } ;; - --revision=*|--targets=*|--username=*|--password=*|--config-dir=*|--limit=*) + --username|--password|--config-dir) + # add these as extra options to the command (with argument) + arg=`echo "$2" | sed "s/'/'\"'\"'/g"` + SVNLOGCMD="$SVNLOGCMD $1 '$arg'" + # also add to svn info command + SVNINFOCMD="$SVNINFOCMD $1 '$arg'" + shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; } + ;; + --revision=*|--targets=*|--limit=*) + # these are single argument versions of the above + arg=`echo "$1" | sed "s/'/'\"'\"'/g"` + SVNLOGCMD="$SVNLOGCMD '$arg'" + shift + ;; + --username=*|--password=*|--config-dir=*) # these are single argument versions of the above arg=`echo "$1" | sed "s/'/'\"'\"'/g"` - SVNCMD="$SVNCMD '$arg'" + SVNLOGCMD="$SVNLOGCMD '$arg'" + # also add to svn info command + SVNINFOCMD="$SVNINFOCMD '$arg'" + shift + ;; + --stop-on-copy) + # add these as simple options + SVNLOGCMD="$SVNLOGCMD $1" shift ;; - --stop-on-copy|--no-auth-cache|--non-interactive) + --no-auth-cache|--non-interactive) # add these as simple options - SVNCMD="$SVNCMD $1" + SVNLOGCMD="$SVNLOGCMD $1" + # also add to svn info command + SVNINFOCMD="$SVNINFOCMD $1" shift ;; -V|--version) @@ -155,9 +201,11 @@ echo " --group-by-day group changelog entries by day" echo " --separate-daylogs put a blank line between grouped by day entries" echo " -i, --include-rev include revision numbers" - echo " --break-before-msg add a line break between the log paths and" - echo " log message" + echo " --break-before-msg[=NUM] add a line break (or multiple breaks)" + echo " between the paths and the log message" echo " --reparagraph rewrap lines inside a paragraph" + echo " --title=NAME title used in html file" + echo " --revision-link=NAME link revision numbers in html output" echo " -o, --output=FILE output to FILE instead of ChangeLog" echo " -f, --file=FILE alias for -o, --output" echo " --stdout output to stdout instead of ChangeLog" @@ -179,8 +227,8 @@ ;; *) arg=`echo "$1" | sed "s/'/'\"'\"'/g"` - SVNCMD="$SVNCMD '$arg'" - PATHS="$PATHS '$arg'" + SVNLOGCMD="$SVNLOGCMD '$arg'" + SVNINFOCMD="$SVNINFOCMD '$arg'" shift ;; esac @@ -193,8 +241,8 @@ dir=`dirname "$prog"` prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$dir/,"` done -dir=`dirname $prog` -dir=`cd $dir && pwd` +dir=`dirname "$prog"` +dir=`cd "$dir" && pwd` XSL="$dir/svn2${OUTSTYLE}.xsl" # check if the authors file is formatted as a legacy @@ -229,8 +277,8 @@ # try to determin a prefix to strip from all paths if [ "$STRIPPREFIX" = "AUTOMATICALLY-DETERMINED" ] then - # FIXME: this breaks with spaces in repository names - STRIPPREFIX=`eval "svn info $PATHS" | awk '/^URL:/{url=$2} /^Repository Root:/{root=$3} END{if(root){print substr(url,length(root)+2)}else{gsub("^.*/","",url);print url}}'` + STRIPPREFIX=`LANG=C eval "$SVNINFOCMD" 2> /dev/null | awk '/^URL:/{url=$2} /^Repository Root:/{root=$3} END{if(root){print substr(url,length(root)+2)}else{gsub("^.*/","",url);print url}}'` + STRIPPREFIX=`echo "$STRIPPREFIX" | sed 's/%20/ /g'` fi # redirect stdout to the changelog file if needed @@ -240,7 +288,7 @@ fi # actually run the command we need -eval "$SVNCMD" | \ +eval "$SVNLOGCMD" | \ xsltproc --stringparam strip-prefix "$STRIPPREFIX" \ --stringparam linelen "$LINELEN" \ --stringparam groupbyday "$GROUPBYDAY" \ @@ -249,6 +297,11 @@ --stringparam breakbeforemsg "$BREAKBEFOREMSG" \ --stringparam reparagraph "$REPARAGRAPH" \ --stringparam authorsfile "$AUTHORSFILE" \ + --stringparam title "$TITLE" \ + --stringparam revision-link "$REVISION_LINK" \ + --nowrite \ + --nomkdir \ + --nonet \ "$XSL" - # clean up temporary files diff -Naur a/contrib/client-side/svn2cl/svn2cl.xsl b/contrib/client-side/svn2cl/svn2cl.xsl --- a/contrib/client-side/svn2cl/svn2cl.xsl 2006-04-10 23:39:45.000000000 +0200 +++ b/contrib/client-side/svn2cl/svn2cl.xsl 2006-10-22 01:08:30.000000000 +0200 @@ -5,6 +5,8 @@ svn2cl.xsl - xslt stylesheet for converting svn log to a normal changelog + version 0.8 + Usage (replace ++ with two minus signs which aren't allowed inside xml comments): svn ++verbose ++xml log | \ @@ -13,7 +15,7 @@ ++stringparam groupbyday yes \ ++stringparam separate-daylogs yes \ ++stringparam include-rev yes \ - ++stringparam breakbeforemsg yes \ + ++stringparam breakbeforemsg yes/2 \ ++stringparam reparagraph yes \ ++stringparam authorsfile FILE \ svn2cl.xsl - > ChangeLog @@ -51,7 +53,7 @@ --> -<!DOCTYPE stylesheet [ +<!DOCTYPE xsl:stylesheet [ <!ENTITY tab "	"> <!ENTITY newl " "> <!ENTITY space " "> @@ -94,12 +96,12 @@ <!-- location of authors file if any --> <xsl:param name="authorsfile" select="''" /> - <xsl:key name="author-lookup" match="author" use="@uid"/> - <xsl:variable name="authors-top" select="document($authorsfile)/authors"/> + <xsl:key name="author-lookup" match="author" use="@uid" /> + <xsl:variable name="authors-top" select="document($authorsfile)/authors" /> <!-- add newlines at the end of the changelog --> <xsl:template match="log"> - <xsl:apply-templates/> + <xsl:apply-templates /> <xsl:text>&newl;</xsl:text> </xsl:template> @@ -175,9 +177,16 @@ <!-- trim trailing newlines --> <xsl:variable name="msg"> <!-- add a line break before the log message --> - <xsl:if test="$breakbeforemsg='yes'"> - <xsl:text>&newl;</xsl:text> - </xsl:if> + <xsl:choose> + <xsl:when test="$breakbeforemsg='yes'"> + <xsl:text>&newl;</xsl:text> + </xsl:when> + <xsl:when test="number($breakbeforemsg)>0"> + <xsl:call-template name="newlines"> + <xsl:with-param name="count" select="number($breakbeforemsg)" /> + </xsl:call-template> + </xsl:when> + </xsl:choose> <xsl:call-template name="trim-newln"> <xsl:with-param name="txt" select="msg" /> </xsl:call-template> @@ -208,17 +217,20 @@ <xsl:template match="author"> <xsl:variable name="uid" select="normalize-space(.)" /> <!-- try to lookup author in authorsfile --> - <xsl:variable name="author"> - <xsl:if test="$authorsfile!=''"> + <xsl:choose> + <xsl:when test="$authorsfile!=''"> <xsl:for-each select="$authors-top"> - <xsl:value-of select="normalize-space(key('author-lookup',$uid))" /> + <xsl:variable name="author" select="key('author-lookup',$uid)" /> + <!-- present result --> + <xsl:choose> + <xsl:when test="string($author/.)"> + <xsl:apply-templates select="$author/node()" mode="copy" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$uid" /> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> - </xsl:if> - </xsl:variable> - <!-- present result --> - <xsl:choose> - <xsl:when test="string($author)"> - <xsl:value-of select="$author" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$uid" /> @@ -226,6 +238,18 @@ </xsl:choose> </xsl:template> + <!-- copy but normalize text --> + <xsl:template match="text()" mode="copy"> + <xsl:value-of select="normalize-space(.)" /> + </xsl:template> + + <!-- simple copy template --> + <xsl:template match="@*|node()" mode="copy"> + <xsl:copy> + <xsl:apply-templates select="@*|node()" mode="copy" /> + </xsl:copy> + </xsl:template> + <!-- present a list of paths names --> <xsl:template match="paths"> <xsl:for-each select="path"> @@ -302,6 +326,7 @@ <!-- string-wrapping template --> <xsl:template name="wrap"> <xsl:param name="txt" /> + <xsl:variable name="normtxt" select="normalize-space($txt)" /> <xsl:choose> <xsl:when test="contains($txt,'&newl;')"> <!-- text contains newlines, do the first line --> @@ -315,33 +340,36 @@ <xsl:with-param name="txt" select="substring-after($txt,'&newl;')" /> </xsl:call-template> </xsl:when> - <xsl:when test="(string-length($txt) < (($linelen)-9)) or not(contains($txt,' '))"> + <xsl:when test="(string-length($normtxt) < (($linelen)-9)) or not(contains($normtxt,' '))"> <!-- this is easy, nothing to do --> - <xsl:value-of select="normalize-space($txt)" /> + <xsl:value-of select="$normtxt" /> <!-- add newline --> <xsl:text>&newl;</xsl:text> </xsl:when> <xsl:otherwise> <!-- find the first line --> - <xsl:variable name="tmp" select="substring($txt,1,(($linelen)-10))" /> + <xsl:variable name="tmp" select="substring($normtxt,1,(($linelen)-9))" /> <xsl:variable name="line"> <xsl:choose> + <!-- if our attempt contains spaces wrap on that --> <xsl:when test="contains($tmp,' ')"> <xsl:call-template name="find-line"> <xsl:with-param name="txt" select="$tmp" /> </xsl:call-template> </xsl:when> + <!-- otherwise use the first non-space characters from the text --> <xsl:otherwise> - <xsl:value-of select="normalize-space(substring-before($txt,' '))" /> + <xsl:value-of select="substring-before($normtxt,' ')" /> </xsl:otherwise> </xsl:choose> </xsl:variable> + <!-- print line --> + <xsl:value-of select="$line" /> <!-- print newline and tab --> - <xsl:value-of select="normalize-space($line)" /> <xsl:text>&newl;&tab;&space;&space;</xsl:text> <!-- wrap the rest of the text --> <xsl:call-template name="wrap"> - <xsl:with-param name="txt" select="substring($txt,string-length($line)+1)" /> + <xsl:with-param name="txt" select="normalize-space(substring($normtxt,string-length($line)+1))" /> </xsl:call-template> </xsl:otherwise> </xsl:choose> @@ -351,8 +379,8 @@ <xsl:template name="find-line"> <xsl:param name="txt" /> <xsl:choose> - <xsl:when test="substring($txt,string-length($txt),1) = ' '"> - <xsl:value-of select="$txt" /> + <xsl:when test="substring($txt,string-length($txt),1)=' '"> + <xsl:value-of select="substring($txt,1,string-length($txt)-1)" /> </xsl:when> <xsl:otherwise> <xsl:call-template name="find-line"> @@ -400,4 +428,15 @@ </xsl:choose> </xsl:template> + <!-- insert a number of newlines --> + <xsl:template name="newlines"> + <xsl:param name="count" /> + <xsl:text>&newl;</xsl:text> + <xsl:if test="$count>1"> + <xsl:call-template name="newlines"> + <xsl:with-param name="count" select="($count)-1" /> + </xsl:call-template> + </xsl:if> + </xsl:template> + </xsl:stylesheet> diff -Naur a/contrib/client-side/svn2cl/svn2html.xsl b/contrib/client-side/svn2cl/svn2html.xsl --- a/contrib/client-side/svn2cl/svn2html.xsl 2006-04-10 23:39:45.000000000 +0200 +++ b/contrib/client-side/svn2cl/svn2html.xsl 2006-10-22 01:08:22.000000000 +0200 @@ -5,14 +5,18 @@ svn2html.xsl - xslt stylesheet for converting svn log to a normal changelog fromatted in html + version 0.8 + Usage (replace ++ with two minus signs): svn ++verbose ++xml log | \ xsltproc ++stringparam strip-prefix `basename $(pwd)` \ ++stringparam groupbyday yes \ ++stringparam authorsfile FILE \ + ++stringparam title NAME \ + ++stringparam revision-link NAME \ svn2html.xsl - > ChangeLog.html - This file is partially based on svn2cl.xsl. + This file is partially based on (and includes) svn2cl.xsl. Copyright (C) 2005, 2006 Arthur de Jong. @@ -43,7 +47,7 @@ --> -<!DOCTYPE stylesheet [ +<!DOCTYPE xsl:stylesheet [ <!ENTITY newl " "> <!ENTITY space " "> ]> @@ -66,20 +70,29 @@ doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" /> + <!-- title of the report --> + <xsl:param name="title" select="'ChangeLog'" /> + + <!-- link to use for linking revision numbers --> + <xsl:param name="revision-link" select="'#r'" /> + <!-- match toplevel element --> <xsl:template match="log"> <html> <head> - <title>ChangeLog</title> + <title><xsl:value-of select="string($title)" /></title> <link rel="stylesheet" href="svn2html.css" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> + <xsl:if test="$title"> + <h1><xsl:value-of select="string($title)" /></h1> + </xsl:if> <ul class="changelog_entries"> <xsl:apply-templates /> </ul> <p class="changelog_footer"> - <xsl:text>Generated by </xsl:text><a href="http://ch.tudelft.nl/~arthur/svn2cl/">svn2cl 0.7</a> + <xsl:text>Generated by </xsl:text><a href="http://ch.tudelft.nl/~arthur/svn2cl/">svn2cl 0.8</a> </p> </body> </html> @@ -133,8 +146,18 @@ <!-- entry --> <li class="changelog_change"> <!-- get revision number --> + <xsl:variable name="revlink"> + <xsl:choose> + <xsl:when test="contains($revision-link,'##')"> + <xsl:value-of select="concat(substring-before($revision-link,'##'),@revision,substring-after($revision-link,'##'))" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($revision-link,@revision)" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> <span class="changelog_revision"> - <a id="[EMAIL PROTECTED]" href="[EMAIL PROTECTED]">[r<xsl:value-of select="@revision" />]</a> + <a id="[EMAIL PROTECTED]" href="{$revlink}">[r<xsl:value-of select="@revision" />]</a> </span> <xsl:text>&space;</xsl:text> <!-- get paths string --> @@ -154,7 +177,7 @@ </li> </xsl:template> - <!-- template to replace line breaks with <br/> tags --> + <!-- template to replace line breaks with <br /> tags --> <xsl:template name="newlinestobr"> <xsl:param name="txt" /> <xsl:choose> diff -Naur a/contrib/client-side/svn2cl/TODO b/contrib/client-side/svn2cl/TODO --- a/contrib/client-side/svn2cl/TODO 2006-04-10 23:39:45.000000000 +0200 +++ b/contrib/client-side/svn2cl/TODO 2006-10-22 01:08:22.000000000 +0200 @@ -1,5 +1,4 @@ * flag deleted files (<path action="D"...>) -* look at more command line compatibility with cvs2cl (e.g. -r, --revisions, --show-dead, --no-wrap, --hide-filenames, --lines-modified) * support more xslt processors * group changes per autor per day * svn2rss? @@ -7,3 +6,4 @@ * improve performance of processing authors.xml * fix awk magic to not break with spaces in repository names * find better names for options +* create backup of previous changelog file
signature.asc
Description: This is a digitally signed message part