aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-11-08 13:53:48 +0100
committerChristian Grothoff <christian@grothoff.org>2016-11-08 13:53:48 +0100
commitd8e2905c74e63975af5ffe79d7fb1247328def94 (patch)
tree55092d560ee9c27435414f281f8b6b757282997a /contrib
parent5b9aeb0a9e957b084809679ca0fc83c24fde88d2 (diff)
downloadgnunet-d8e2905c74e63975af5ffe79d7fb1247328def94.tar.gz
gnunet-d8e2905c74e63975af5ffe79d7fb1247328def94.zip
remove obsolete svn to change log script
Diffstat (limited to 'contrib')
-rw-r--r--contrib/svn2cl.xsl494
1 files changed, 0 insertions, 494 deletions
diff --git a/contrib/svn2cl.xsl b/contrib/svn2cl.xsl
deleted file mode 100644
index 3d9db0200..000000000
--- a/contrib/svn2cl.xsl
+++ /dev/null
@@ -1,494 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4
5 svn2cl.xsl - xslt stylesheet for converting svn log to a normal
6 changelog
7
8 version 0.11
9
10 Usage (replace ++ with two minus signs which aren't allowed
11 inside xml comments):
12 svn ++verbose ++xml log | \
13 xsltproc ++stringparam strip-prefix `basename $(pwd)` \
14 ++stringparam linelen 75 \
15 ++stringparam groupbyday yes \
16 ++stringparam separate-daylogs yes \
17 ++stringparam include-rev yes \
18 ++stringparam include-actions yes \
19 ++stringparam breakbeforemsg yes/2 \
20 ++stringparam reparagraph yes \
21 ++stringparam authorsfile FILE \
22 ++stringparam ignore-message-starting \
23 svn2cl.xsl - > ChangeLog
24
25 This file is based on several implementations of this conversion
26 that I was not completely happy with and some other common
27 xslt constructs found on the web.
28
29 Copyright (C) 2004, 2005, 2006, 2007 Arthur de Jong.
30
31 Redistribution and use in source and binary forms, with or without
32 modification, are permitted provided that the following conditions
33 are met:
34 1. Redistributions of source code must retain the above copyright
35 notice, this list of conditions and the following disclaimer.
36 2. Redistributions in binary form must reproduce the above copyright
37 notice, this list of conditions and the following disclaimer in
38 the documentation and/or other materials provided with the
39 distribution.
40 3. The name of the author may not be used to endorse or promote
41 products derived from this software without specific prior
42 written permission.
43
44 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
45 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
46 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
48 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
50 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
51 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
52 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
53 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
54 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55
56-->
57
58<!DOCTYPE xsl:stylesheet [
59 <!ENTITY space "&#32;">
60]>
61
62<xsl:stylesheet
63 version="1.0"
64 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
65
66 <xsl:output
67 method="text"
68 encoding="utf-8"
69 media-type="text/plain"
70 omit-xml-declaration="yes"
71 standalone="yes"
72 indent="no" />
73
74 <xsl:strip-space elements="*" />
75
76 <!-- the prefix of pathnames to strip -->
77 <xsl:param name="strip-prefix" select="'/'" />
78
79 <!-- the length of a line to wrap messages at -->
80 <xsl:param name="linelen" select="75" />
81
82 <!-- whether entries should be grouped by day -->
83 <xsl:param name="groupbyday" select="'no'" />
84
85 <!-- whether to seperate log messages by empty lines -->
86 <xsl:param name="separate-daylogs" select="'no'" />
87
88 <!-- whether a revision number should be included -->
89 <xsl:param name="include-rev" select="'no'" />
90
91 <!-- whether aaction labels should be added to files -->
92 <xsl:param name="include-actions" select="'no'" />
93
94 <!-- whether the log message should start on a new line -->
95 <xsl:param name="breakbeforemsg" select="'no'" />
96
97 <!-- whether the message should be rewrapped within one paragraph -->
98 <xsl:param name="reparagraph" select="'no'" />
99
100 <!-- whether certain messages should be ignored -->
101 <xsl:param name="ignore-message-starting" select="''" />
102
103 <!-- location of authors file if any -->
104 <xsl:param name="authorsfile" select="''" />
105 <xsl:key name="author-lookup" match="author" use="@uid" />
106 <xsl:variable name="authors-top" select="document($authorsfile)/authors" />
107
108 <!-- match the topmost log entry -->
109 <xsl:template match="log">
110 <xsl:choose>
111 <xsl:when test="$ignore-message-starting != ''">
112 <!-- only handle logentries with don't contain the string -->
113 <xsl:apply-templates select="logentry[not(starts-with(msg,$ignore-message-starting))]" />
114 </xsl:when>
115 <xsl:otherwise>
116 <xsl:apply-templates select="logentry" />
117 </xsl:otherwise>
118 </xsl:choose>
119 <!-- add newlines at the end of the changelog -->
120 <xsl:text>&#xA;</xsl:text>
121 </xsl:template>
122
123 <!-- format one entry from the log -->
124 <xsl:template match="logentry">
125 <xsl:choose>
126 <!-- if we're grouping we should omit some headers -->
127 <xsl:when test="$groupbyday='yes'">
128 <!-- save log entry number -->
129 <xsl:variable name="pos" select="position()" />
130 <!-- fetch previous entry's date -->
131 <xsl:variable name="prevdate">
132 <xsl:apply-templates select="../logentry[position()=(($pos)-1)]/date" />
133 </xsl:variable>
134 <!-- fetch previous entry's author -->
135 <xsl:variable name="prevauthor">
136 <xsl:value-of select="normalize-space(../logentry[position()=(($pos)-1)]/author)" />
137 </xsl:variable>
138 <!-- fetch this entry's date -->
139 <xsl:variable name="date">
140 <xsl:apply-templates select="date" />
141 </xsl:variable>
142 <!-- fetch this entry's author -->
143 <xsl:variable name="author">
144 <xsl:value-of select="normalize-space(author)" />
145 </xsl:variable>
146 <!-- check if header is changed -->
147 <xsl:if test="($prevdate!=$date) or ($prevauthor!=$author)">
148 <!-- add newline -->
149 <xsl:if test="not(position()=1)">
150 <xsl:text>&#xA;</xsl:text>
151 </xsl:if>
152 <!-- date -->
153 <xsl:value-of select="$date" />
154 <!-- two spaces -->
155 <xsl:text>&space;&space;</xsl:text>
156 <!-- author's name -->
157 <xsl:apply-templates select="author" />
158 <!-- two newlines -->
159 <xsl:text>&#xA;</xsl:text>
160 <xsl:if test="$separate-daylogs!='yes'"><xsl:text>&#xA;</xsl:text></xsl:if>
161 </xsl:if>
162 </xsl:when>
163 <!-- write the log header -->
164 <xsl:otherwise>
165 <!-- add newline -->
166 <xsl:if test="not(position()=1)">
167 <xsl:text>&#xA;</xsl:text>
168 </xsl:if>
169 <!-- date -->
170 <xsl:apply-templates select="date" />
171 <!-- two spaces -->
172 <xsl:text>&space;&space;</xsl:text>
173 <!-- author's name -->
174 <xsl:apply-templates select="author" />
175 <!-- two newlines -->
176 <xsl:text>&#xA;&#xA;</xsl:text>
177 </xsl:otherwise>
178 </xsl:choose>
179 <!-- get paths string -->
180 <xsl:variable name="paths">
181 <xsl:apply-templates select="paths" />
182 </xsl:variable>
183 <!-- get revision number -->
184 <xsl:variable name="rev">
185 <xsl:if test="$include-rev='yes'">
186 <xsl:text>[r</xsl:text>
187 <xsl:value-of select="@revision" />
188 <xsl:text>]&space;</xsl:text>
189 </xsl:if>
190 </xsl:variable>
191 <!-- trim trailing newlines -->
192 <xsl:variable name="msg">
193 <!-- add a line break before the log message -->
194 <xsl:choose>
195 <xsl:when test="$breakbeforemsg='yes'">
196 <xsl:text>&#xA;</xsl:text>
197 </xsl:when>
198 <xsl:when test="number($breakbeforemsg)&gt;0">
199 <xsl:call-template name="newlines">
200 <xsl:with-param name="count" select="number($breakbeforemsg)" />
201 </xsl:call-template>
202 </xsl:when>
203 </xsl:choose>
204 <xsl:call-template name="trim-newln">
205 <xsl:with-param name="txt" select="msg" />
206 </xsl:call-template>
207 </xsl:variable>
208 <!-- add newline here if separate-daylogs is in effect -->
209 <xsl:if test="$groupbyday='yes' and $separate-daylogs='yes'"><xsl:text>&#xA;</xsl:text></xsl:if>
210 <!-- first line is indented (other indents are done in wrap template) -->
211 <xsl:text>&#x9;*&space;</xsl:text>
212 <!-- set up the text to wrap -->
213 <xsl:variable name="txt">
214 <xsl:value-of select="$rev" />
215 <xsl:if test="$paths!=''">
216 <xsl:value-of select="concat($paths,':&space;')" />
217 </xsl:if>
218 <xsl:value-of select="$msg" />
219 </xsl:variable>
220 <!-- print the paths and message nicely wrapped -->
221 <xsl:call-template name="wrap">
222 <xsl:with-param name="txt" select="$txt" />
223 </xsl:call-template>
224 </xsl:template>
225
226 <!-- format date -->
227 <xsl:template match="date">
228 <xsl:variable name="date" select="normalize-space(.)" />
229 <!-- output date part -->
230 <xsl:value-of select="substring($date,1,10)" />
231 <!-- output time part -->
232 <xsl:if test="$groupbyday!='yes'">
233 <xsl:text>&space;</xsl:text>
234 <xsl:value-of select="substring($date,12,5)" />
235 </xsl:if>
236 </xsl:template>
237
238 <!-- format author -->
239 <xsl:template match="author">
240 <xsl:variable name="uid" select="normalize-space(.)" />
241 <!-- try to lookup author in authorsfile -->
242 <xsl:choose>
243 <xsl:when test="$authorsfile!=''">
244 <xsl:for-each select="$authors-top">
245 <xsl:variable name="author" select="key('author-lookup',$uid)" />
246 <!-- present result -->
247 <xsl:choose>
248 <xsl:when test="string($author/.)">
249 <xsl:apply-templates select="$author/node()" mode="copy" />
250 </xsl:when>
251 <xsl:otherwise>
252 <xsl:value-of select="$uid" />
253 </xsl:otherwise>
254 </xsl:choose>
255 </xsl:for-each>
256 </xsl:when>
257 <xsl:otherwise>
258 <xsl:value-of select="$uid" />
259 </xsl:otherwise>
260 </xsl:choose>
261 </xsl:template>
262
263 <!-- copy but normalize text -->
264 <xsl:template match="text()" mode="copy">
265 <xsl:value-of select="normalize-space(.)" />
266 </xsl:template>
267
268 <!-- simple copy template -->
269 <xsl:template match="@*|node()" mode="copy">
270 <xsl:copy>
271 <xsl:apply-templates select="@*|node()" mode="copy" />
272 </xsl:copy>
273 </xsl:template>
274
275 <!-- present a list of paths names -->
276 <xsl:template match="paths">
277 <xsl:choose>
278 <!-- only handle paths that begin with the path and strip the path -->
279 <xsl:when test="$strip-prefix != ''">
280 <!-- if strip-prefix does not start with a slash, prepend it -->
281 <xsl:variable name="tmpstrip1">
282 <xsl:choose>
283 <xsl:when test="starts-with($strip-prefix,'/')">
284 <xsl:value-of select="$strip-prefix" />
285 </xsl:when>
286 <xsl:otherwise>
287 <xsl:value-of select="concat('/',$strip-prefix)" />
288 </xsl:otherwise>
289 </xsl:choose>
290 </xsl:variable>
291 <!-- strip trailing slash from strip-prefix -->
292 <xsl:variable name="tmpstrip2">
293 <xsl:choose>
294 <xsl:when test="substring($tmpstrip1,string-length($tmpstrip1),1)='/'">
295 <xsl:value-of select="substring($tmpstrip1,1,string-length($tmpstrip1)-1)" />
296 </xsl:when>
297 <xsl:otherwise>
298 <xsl:value-of select="$tmpstrip1" />
299 </xsl:otherwise>
300 </xsl:choose>
301 </xsl:variable>
302 <!-- filter on all entries within directory -->
303 <xsl:for-each select="path[starts-with(concat(normalize-space(.),'/'),concat($tmpstrip2,'/'))]">
304 <xsl:sort select="normalize-space(.)" data-type="text" />
305 <!-- unless we are the first entry, add a comma -->
306 <xsl:if test="not(position()=1)">
307 <xsl:text>,&space;</xsl:text>
308 </xsl:if>
309 <!-- print the path name -->
310 <xsl:call-template name="printpath">
311 <xsl:with-param name="path" select="substring(normalize-space(.),string-length($strip-prefix)+3)" />
312 </xsl:call-template>
313 <!-- add the action flag -->
314 <xsl:if test="$include-actions='yes'">
315 <xsl:apply-templates select="." mode="action"/>
316 </xsl:if>
317 </xsl:for-each>
318 </xsl:when>
319 <!-- print a simple list of all paths -->
320 <xsl:otherwise>
321 <xsl:for-each select="path">
322 <xsl:sort select="normalize-space(.)" data-type="text" />
323 <!-- unless we are the first entry, add a comma -->
324 <xsl:if test="not(position()=1)">
325 <xsl:text>,&space;</xsl:text>
326 </xsl:if>
327 <!-- print the path name -->
328 <xsl:value-of select="normalize-space(.)" />
329 <!-- add the action flag -->
330 <xsl:if test="$include-actions='yes'">
331 <xsl:apply-templates select="." mode="action"/>
332 </xsl:if>
333 </xsl:for-each>
334 </xsl:otherwise>
335 </xsl:choose>
336 </xsl:template>
337
338 <xsl:template match="path" mode="action">
339 <xsl:choose>
340 <xsl:when test="@action='D'">
341 <xsl:text>[DEL]</xsl:text>
342 </xsl:when>
343 <xsl:when test="@copyfrom-path">
344 <xsl:text>[CPY]</xsl:text>
345 </xsl:when>
346 <xsl:when test="@action='D'">
347 <xsl:text>[ADD]</xsl:text>
348 </xsl:when>
349 </xsl:choose>
350 </xsl:template>
351
352 <!-- transform path to something printable -->
353 <xsl:template name="printpath">
354 <!-- fetch the pathname -->
355 <xsl:param name="path" />
356 <!-- strip leading slash -->
357 <xsl:variable name="tmp1">
358 <xsl:choose>
359 <xsl:when test="starts-with($path,'/')">
360 <xsl:value-of select="substring($path,2)" />
361 </xsl:when>
362 <xsl:otherwise>
363 <xsl:value-of select="$path" />
364 </xsl:otherwise>
365 </xsl:choose>
366 </xsl:variable>
367 <!-- translate empty string to dot -->
368 <xsl:choose>
369 <xsl:when test="$tmp1 = ''">
370 <xsl:text>.</xsl:text>
371 </xsl:when>
372 <xsl:otherwise>
373 <xsl:value-of select="$tmp1" />
374 </xsl:otherwise>
375 </xsl:choose>
376 </xsl:template>
377
378 <!-- string-wrapping template -->
379 <xsl:template name="wrap">
380 <xsl:param name="txt" />
381 <xsl:variable name="normtxt" select="normalize-space($txt)" />
382 <xsl:choose>
383 <xsl:when test="contains($txt,'&#xA;')">
384 <!-- text contains newlines, do the first line -->
385 <xsl:call-template name="wrap">
386 <xsl:with-param name="txt" select="substring-before($txt,'&#xA;')" />
387 </xsl:call-template>
388 <!-- print tab -->
389 <xsl:text>&#x9;&space;&space;</xsl:text>
390 <!-- wrap the rest of the text -->
391 <xsl:call-template name="wrap">
392 <xsl:with-param name="txt" select="substring-after($txt,'&#xA;')" />
393 </xsl:call-template>
394 </xsl:when>
395 <xsl:when test="(string-length($normtxt) &lt; (($linelen)-9)) or not(contains($normtxt,' '))">
396 <!-- this is easy, nothing to do -->
397 <xsl:value-of select="$normtxt" />
398 <!-- add newline -->
399 <xsl:text>&#xA;</xsl:text>
400 </xsl:when>
401 <xsl:otherwise>
402 <!-- find the first line -->
403 <xsl:variable name="tmp" select="substring($normtxt,1,(($linelen)-9))" />
404 <xsl:variable name="line">
405 <xsl:choose>
406 <!-- if our attempt contains spaces wrap on that -->
407 <xsl:when test="contains($tmp,' ')">
408 <xsl:call-template name="find-line">
409 <xsl:with-param name="txt" select="$tmp" />
410 </xsl:call-template>
411 </xsl:when>
412 <!-- otherwise use the first non-space characters from the text -->
413 <xsl:otherwise>
414 <xsl:value-of select="substring-before($normtxt,' ')" />
415 </xsl:otherwise>
416 </xsl:choose>
417 </xsl:variable>
418 <!-- print line -->
419 <xsl:value-of select="$line" />
420 <!-- print newline and tab -->
421 <xsl:text>&#xA;&#x9;&space;&space;</xsl:text>
422 <!-- wrap the rest of the text -->
423 <xsl:call-template name="wrap">
424 <xsl:with-param name="txt" select="normalize-space(substring($normtxt,string-length($line)+1))" />
425 </xsl:call-template>
426 </xsl:otherwise>
427 </xsl:choose>
428 </xsl:template>
429
430 <!-- template to trim line to contain space as last char -->
431 <xsl:template name="find-line">
432 <xsl:param name="txt" />
433 <xsl:choose>
434 <xsl:when test="substring($txt,string-length($txt),1)=' '">
435 <xsl:value-of select="substring($txt,1,string-length($txt)-1)" />
436 </xsl:when>
437 <xsl:otherwise>
438 <xsl:call-template name="find-line">
439 <xsl:with-param name="txt" select="substring($txt,1,string-length($txt)-1)" />
440 </xsl:call-template>
441 </xsl:otherwise>
442 </xsl:choose>
443 </xsl:template>
444
445 <!-- template to trim trailing and starting newlines -->
446 <xsl:template name="trim-newln">
447 <xsl:param name="txt" />
448 <xsl:choose>
449 <!-- find starting newlines -->
450 <xsl:when test="substring($txt,1,1) = '&#xA;'">
451 <xsl:call-template name="trim-newln">
452 <xsl:with-param name="txt" select="substring($txt,2)" />
453 </xsl:call-template>
454 </xsl:when>
455 <!-- find trailing newlines -->
456 <xsl:when test="substring($txt,string-length($txt),1) = '&#xA;'">
457 <xsl:call-template name="trim-newln">
458 <xsl:with-param name="txt" select="substring($txt,1,string-length($txt)-1)" />
459 </xsl:call-template>
460 </xsl:when>
461 <!-- if the message has paragrapgs, find the first one -->
462 <xsl:when test="$reparagraph='yes' and contains($txt,'&#xA;&#xA;')">
463 <!-- remove newlines from first paragraph -->
464 <xsl:value-of select="normalize-space(substring-before($txt,'&#xA;&#xA;'))" />
465 <!-- paragraph separator -->
466 <xsl:text>&#xA;&#xA;</xsl:text>
467 <!-- do the rest of the text -->
468 <xsl:call-template name="trim-newln">
469 <xsl:with-param name="txt" select="substring-after($txt,'&#xA;&#xA;')" />
470 </xsl:call-template>
471 </xsl:when>
472 <!-- remove more single newlines -->
473 <xsl:when test="$reparagraph='yes'">
474 <xsl:value-of select="normalize-space($txt)" />
475 </xsl:when>
476 <!-- no newlines found, we're done -->
477 <xsl:otherwise>
478 <xsl:value-of select="$txt" />
479 </xsl:otherwise>
480 </xsl:choose>
481 </xsl:template>
482
483 <!-- insert a number of newlines -->
484 <xsl:template name="newlines">
485 <xsl:param name="count" />
486 <xsl:text>&#xA;</xsl:text>
487 <xsl:if test="$count&gt;1">
488 <xsl:call-template name="newlines">
489 <xsl:with-param name="count" select="($count)-1" />
490 </xsl:call-template>
491 </xsl:if>
492 </xsl:template>
493
494</xsl:stylesheet>