/[vps]/baselayout-vserver/trunk/src/core/scripts/svn2cl.sh
Gentoo

Contents of /baselayout-vserver/trunk/src/core/scripts/svn2cl.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 236 - (show annotations) (download) (as text)
Tue Feb 14 13:00:44 2006 UTC (8 years, 6 months ago) by phreak
File MIME type: text/x-sh
File size: 6109 byte(s)
Merging r1881
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 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 # report unset variables
36 set -u
37
38 # svn2cl version
39 VERSION="0.5"
40
41 # set default parameters
42 PWD=`pwd`
43 STRIPPREFIX=`basename $PWD`
44 LINELEN=75
45 GROUPBYDAY="no"
46 INCLUDEREV="no"
47 CHANGELOG=""
48 OUTSTYLE="cl"
49 SVNCMD="svn --verbose --xml log"
50
51 # do command line checking
52 prog=`basename $0`
53 while [ $# -gt 0 ]
54 do
55 case "$1" in
56 --strip-prefix)
57 STRIPPREFIX="$2"
58 shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; }
59 ;;
60 --strip-prefix=*)
61 STRIPPREFIX="`echo "$1" | sed 's/--strip-prefix=//'`"
62 shift
63 ;;
64 --linelen)
65 LINELEN="$2";
66 shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; }
67 ;;
68 --linelen=*)
69 LINELEN="`echo "$1" | sed 's/--linelen=//'`"
70 shift
71 ;;
72 --group-by-day)
73 GROUPBYDAY="yes";
74 shift
75 ;;
76 -i|--include-rev)
77 INCLUDEREV="yes";
78 shift
79 ;;
80 -f|--file|-o|--output)
81 CHANGELOG="$2"
82 shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; }
83 ;;
84 --file=*|--output=*)
85 CHANGELOG="`echo "$1" | sed 's/--[^=]*=//'`"
86 shift
87 ;;
88 --stdout)
89 CHANGELOG="-"
90 shift
91 ;;
92 --html)
93 OUTSTYLE="html"
94 shift
95 ;;
96 -r|--revision|--targets|--username|--password|--config-dir|--limit)
97 # add these as extra options to the command (with argument)
98 arg=`echo "$2" | sed "s/'/'\"'\"'/g"`
99 SVNCMD="$SVNCMD $1 '$arg'"
100 shift 2 || { echo "$prog: option requires an argument -- $1";exit 1; }
101 ;;
102 --revision=*|--targets=*|--username=*|--password=*|--config-dir=*|--limit=*)
103 # these are single argument versions of the above
104 arg=`echo "$1" | sed "s/'/'\"'\"'/g"`
105 SVNCMD="$SVNCMD '$arg'"
106 shift
107 ;;
108 --stop-on-copy|--no-auth-cache|--non-interactive)
109 # add these as simple options
110 SVNCMD="$SVNCMD $1"
111 shift
112 ;;
113 -V|--version)
114 echo "$prog $VERSION";
115 echo "Written by Arthur de Jong."
116 echo ""
117 echo "Copyright (C) 2005 Arthur de Jong."
118 echo "This is free software; see the source for copying conditions. There is NO"
119 echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
120 exit 0
121 ;;
122 -h|--help)
123 echo "Usage: $prog [OPTION]... [PATH]..."
124 echo "Generate a ChangeLog from a subversion repository."
125 echo ""
126 echo " --strip-prefix=NAME prefix to strip from all entries, defaults"
127 echo " to the name of the current directory"
128 echo " --linelen=NUM maximum length of an output line"
129 echo " --group-by-day group changelog entries by day"
130 echo " -i, --include-rev include revision numbers"
131 echo " -o, --output=FILE output to FILE instead of ChangeLog"
132 echo " -f, --file=FILE alias for -o, --output"
133 echo " --stdout output to stdout instead of ChangeLog"
134 echo " --html output as html instead of plain text"
135 echo " -h, --help display this help and exit"
136 echo " -V, --version output version information and exit"
137 echo ""
138 echo "PATH arguments and the following options are passed to the svn log"
139 echo "command: -r, --revision, --target --stop-on-copy, --username,"
140 echo "--password, --no-auth-cache, --non-interactive, --config-dir,"
141 echo "--limit (see \`svn help log' for more information)."
142 exit 0
143 ;;
144 -*)
145 echo "$prog: invalid option -- $1"
146 echo "Try \`$prog --help' for more information."
147 exit 1
148 ;;
149 *)
150 arg=`echo "$1" | sed "s/'/'\"'\"'/g"`
151 SVNCMD="$SVNCMD '$arg'"
152 shift
153 ;;
154 esac
155 done
156
157 # find the directory that this script resides in
158 prog="$0"
159 while [ -h "$prog" ]
160 do
161 dir=`dirname "$prog"`
162 prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$dir/,"`
163 done
164 dir=`dirname $prog`
165 dir=`cd $dir && pwd`
166 XSL="$dir/svn2${OUTSTYLE}.xsl"
167
168 # if no filename was specified, make one up
169 if [ -z "$CHANGELOG" ]
170 then
171 CHANGELOG="ChangeLog"
172 [ "$OUTSTYLE" != "cl" ] && CHANGELOG="$CHANGELOG.$OUTSTYLE"
173 fi
174
175 # redirect stdout to the changelog file if needed
176 if [ "x$CHANGELOG" != "x-" ]
177 then
178 exec > "$CHANGELOG"
179 fi
180
181 # actually run the command we need
182 eval "$SVNCMD" | \
183 xsltproc --stringparam strip-prefix "$STRIPPREFIX" \
184 --stringparam linelen $LINELEN \
185 --stringparam groupbyday $GROUPBYDAY \
186 --stringparam include-rev $INCLUDEREV \
187 "$XSL" -

  ViewVC Help
Powered by ViewVC 1.1.20