Mercurial > hg > buildtools
comparison svn2cl @ 1:2375efb3340d
Added a modified version of svn2cl and the XSL stylesheet.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 09 May 2008 14:12:09 +0300 |
parents | |
children | f27514832835 |
comparison
equal
deleted
inserted
replaced
0:d72d5d73b93a | 1:2375efb3340d |
---|---|
1 #!/bin/sh | |
2 | |
3 # svn2cl.sh - front end shell script for svn2cl.xsl, calls xsltproc | |
4 # with the correct parameters | |
5 # | |
6 # Copyright (C) 2005-2008 Arthur de Jong. | |
7 # | |
8 # Redistribution and use in source and binary forms, with or without | |
9 # modification, are permitted provided that the following conditions | |
10 # are met: | |
11 # 1. Redistributions of source code must retain the above copyright | |
12 # notice, this list of conditions and the following disclaimer. | |
13 # 2. Redistributions in binary form must reproduce the above copyright | |
14 # notice, this list of conditions and the following disclaimer in | |
15 # the documentation and/or other materials provided with the | |
16 # distribution. | |
17 # 3. The name of the author may not be used to endorse or promote | |
18 # products derived from this software without specific prior | |
19 # written permission. | |
20 # | |
21 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
22 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
23 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
25 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
27 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
28 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | |
29 # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
30 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |
31 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
32 | |
33 # exit on any failures | |
34 set -e | |
35 | |
36 # svn2cl version | |
37 VERSION="0.2" | |
38 | |
39 # set default parameters | |
40 STRIPPREFIX=`basename $(pwd)` | |
41 LINELEN=75 | |
42 GROUPBYDAY="yes" | |
43 INCLUDEREV="no" | |
44 CHANGELOG="ChangeLog" | |
45 | |
46 # do command line checking | |
47 prog=`basename $0` | |
48 while [ -n "$1" ] | |
49 do | |
50 case "$1" in | |
51 --strip-prefix) | |
52 STRIPPREFIX="$2" | |
53 shift 2 | |
54 ;; | |
55 --linelen) | |
56 LINELEN="$2"; | |
57 shift 2 | |
58 ;; | |
59 --separate) | |
60 GROUPBYDAY="no"; | |
61 shift | |
62 ;; | |
63 -r|--include-rev) | |
64 INCLUDEREV="yes"; | |
65 shift | |
66 ;; | |
67 -O|--svn-options) | |
68 EXTRAOPTS="$2" | |
69 shift 2 | |
70 ;; | |
71 -o|--output) | |
72 CHANGELOG="$2" | |
73 shift 2 | |
74 ;; | |
75 --stdout) | |
76 CHANGELOG="-" | |
77 shift | |
78 ;; | |
79 -V|--version) | |
80 echo "$prog $VERSION"; | |
81 echo "Written by Arthur de Jong." | |
82 echo "Modified by Matti Hamalainen." | |
83 echo "Copyright (C) 2005-2008 Arthur de Jong." | |
84 echo "" | |
85 echo "This is free software; see the source for copying conditions. There is NO" | |
86 echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." | |
87 exit 0 | |
88 ;; | |
89 -h|--help) | |
90 echo "Usage: $prog [OPTION]..." | |
91 echo "Generate a ChangeLog from a checked out subversion repository." | |
92 echo "" | |
93 echo " --strip-prefix NAME prefix to strip from all entries, defaults" | |
94 echo " to the name of the current directory" | |
95 echo " --linelen NUM maximum length of an output line" | |
96 echo " --separate don't group changelog entries by day" | |
97 echo " -r, --include-rev include revision numbers" | |
98 echo " -o, --output FILE output to FILE instead of ChangeLog" | |
99 echo " --stdout output to stdout instead of ChangeLog" | |
100 echo " -O, --svn-options OPT options passed to Subversion" | |
101 echo " -h, --help display this help and exit" | |
102 echo " -V, --version output version information and exit" | |
103 exit 0 | |
104 ;; | |
105 *) | |
106 echo "$prog: invalid option -- $1" | |
107 echo "Try \`$prog --help' for more information." | |
108 exit 1 | |
109 ;; | |
110 esac | |
111 done | |
112 | |
113 # find the directory that this script resides in | |
114 prog="$0" | |
115 while test -h "$prog"; do | |
116 prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$(dirname "$prog")/,"` | |
117 done | |
118 dir=`dirname $prog` | |
119 dir=`cd $dir && pwd` | |
120 XSL="$dir/svn2cl.xsl" | |
121 | |
122 # redirect stdout to the changelog file if needed | |
123 if test "x$CHANGELOG" != "x-"; then | |
124 exec > "$CHANGELOG" | |
125 fi | |
126 | |
127 # actually run the command we need | |
128 svn --verbose --xml log $SVNOPTS | \ | |
129 xsltproc --stringparam strip-prefix "$STRIPPREFIX" \ | |
130 --stringparam linelen $LINELEN \ | |
131 --stringparam groupbyday $GROUPBYDAY \ | |
132 --stringparam include-rev $INCLUDEREV \ | |
133 "$XSL" - |