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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 235 Revision 236
30# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 30# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 32
33# exit on any failures 33# exit on any failures
34set -e 34set -e
35# report unset variables
36set -u
35 37
36# svn2cl version 38# svn2cl version
37VERSION="0.3" 39VERSION="0.5"
38 40
39# set default parameters 41# set default parameters
42PWD=`pwd`
40STRIPPREFIX=`basename $(pwd)` 43STRIPPREFIX=`basename $PWD`
41LINELEN=75 44LINELEN=75
42GROUPBYDAY="no" 45GROUPBYDAY="no"
43INCLUDEREV="no" 46INCLUDEREV="no"
44CHANGELOG="ChangeLog" 47CHANGELOG=""
48OUTSTYLE="cl"
49SVNCMD="svn --verbose --xml log"
45 50
46# do command line checking 51# do command line checking
47prog=`basename $0` 52prog=`basename $0`
48while [ -n "$1" ] 53while [ $# -gt 0 ]
49do 54do
50 case "$1" in 55 case "$1" in
51 --strip-prefix) 56 --strip-prefix)
52 STRIPPREFIX="$2" 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=//'`"
53 shift 2 62 shift
54 ;; 63 ;;
55 --linelen) 64 --linelen)
56 LINELEN="$2"; 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=//'`"
57 shift 2 70 shift
58 ;; 71 ;;
59 --group-by-day) 72 --group-by-day)
60 GROUPBYDAY="yes"; 73 GROUPBYDAY="yes";
61 shift 74 shift
62 ;; 75 ;;
63 -r|--include-rev) 76 -i|--include-rev)
64 INCLUDEREV="yes"; 77 INCLUDEREV="yes";
65 shift 78 shift
66 ;; 79 ;;
67 -o|--output) 80 -f|--file|-o|--output)
68 CHANGELOG="$2" 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/--[^=]*=//'`"
69 shift 2 86 shift
70 ;; 87 ;;
71 --stdout) 88 --stdout)
72 CHANGELOG="-" 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"
73 shift 111 shift
74 ;; 112 ;;
75 -V|--version) 113 -V|--version)
76 echo "$prog $VERSION"; 114 echo "$prog $VERSION";
77 echo "Written by Arthur de Jong." 115 echo "Written by Arthur de Jong."
80 echo "This is free software; see the source for copying conditions. There is NO" 118 echo "This is free software; see the source for copying conditions. There is NO"
81 echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 119 echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
82 exit 0 120 exit 0
83 ;; 121 ;;
84 -h|--help) 122 -h|--help)
85 echo "Usage: $prog [OPTION]..." 123 echo "Usage: $prog [OPTION]... [PATH]..."
86 echo "Generate a ChangeLog from a checked out subversion repository." 124 echo "Generate a ChangeLog from a subversion repository."
87 echo "" 125 echo ""
88 echo " --strip-prefix NAME prefix to strip from all entries, defaults" 126 echo " --strip-prefix=NAME prefix to strip from all entries, defaults"
89 echo " to the name of the current directory" 127 echo " to the name of the current directory"
90 echo " --linelen NUM maximum length of an output line" 128 echo " --linelen=NUM maximum length of an output line"
91 echo " --group-by-day group changelog entries by day" 129 echo " --group-by-day group changelog entries by day"
92 echo " -r, --include-rev include revision numbers" 130 echo " -i, --include-rev include revision numbers"
93 echo " -o, --output FILE output to FILE instead of ChangeLog" 131 echo " -o, --output=FILE output to FILE instead of ChangeLog"
94 echo " -f, --file FILE alias for -o, --output" 132 echo " -f, --file=FILE alias for -o, --output"
95 echo " --stdout output to stdout instead of ChangeLog" 133 echo " --stdout output to stdout instead of ChangeLog"
134 echo " --html output as html instead of plain text"
96 echo " -h, --help display this help and exit" 135 echo " -h, --help display this help and exit"
97 echo " -V, --version output version information 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)."
98 exit 0 142 exit 0
99 ;; 143 ;;
100 *) 144 -*)
101 echo "$prog: invalid option -- $1" 145 echo "$prog: invalid option -- $1"
102 echo "Try \`$prog --help' for more information." 146 echo "Try \`$prog --help' for more information."
103 exit 1 147 exit 1
148 ;;
149 *)
150 arg=`echo "$1" | sed "s/'/'\"'\"'/g"`
151 SVNCMD="$SVNCMD '$arg'"
152 shift
104 ;; 153 ;;
105 esac 154 esac
106done 155done
107 156
108# find the directory that this script resides in 157# find the directory that this script resides in
109prog="$0" 158prog="$0"
110while [ -h "$prog" ] 159while [ -h "$prog" ]
111do 160do
161 dir=`dirname "$prog"`
112 prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$(dirname "$prog")/,"` 162 prog=`ls -ld "$prog" | sed "s/^.*-> \(.*\)/\1/;/^[^/]/s,^,$dir/,"`
113done 163done
114dir=`dirname $prog` 164dir=`dirname $prog`
115dir=`cd $dir && pwd` 165dir=`cd $dir && pwd`
116XSL="$dir/svn2cl.xsl" 166XSL="$dir/svn2${OUTSTYLE}.xsl"
167
168# if no filename was specified, make one up
169if [ -z "$CHANGELOG" ]
170then
171 CHANGELOG="ChangeLog"
172 [ "$OUTSTYLE" != "cl" ] && CHANGELOG="$CHANGELOG.$OUTSTYLE"
173fi
117 174
118# redirect stdout to the changelog file if needed 175# redirect stdout to the changelog file if needed
119if [ "x$CHANGELOG" != "x-" ] 176if [ "x$CHANGELOG" != "x-" ]
120then 177then
121 exec > "$CHANGELOG" 178 exec > "$CHANGELOG"
122fi 179fi
123 180
124# actually run the command we need 181# actually run the command we need
125svn --verbose --xml log | \ 182eval "$SVNCMD" | \
126 xsltproc --stringparam strip-prefix "$STRIPPREFIX" \ 183 xsltproc --stringparam strip-prefix "$STRIPPREFIX" \
127 --stringparam linelen $LINELEN \ 184 --stringparam linelen $LINELEN \
128 --stringparam groupbyday $GROUPBYDAY \ 185 --stringparam groupbyday $GROUPBYDAY \
129 --stringparam include-rev $INCLUDEREV \ 186 --stringparam include-rev $INCLUDEREV \
130 "$XSL" - 187 "$XSL" -

Legend:
Removed from v.235  
changed lines
  Added in v.236

  ViewVC Help
Powered by ViewVC 1.1.20