Version bump.
[geany-mirror.git] / scripts / svn-changes.sh
blob1753b2d343f16a98074dc521c4a531de085e376a
1 #!/bin/sh
2 # Copyright: 2008, Nick Treleaven
3 # License: GNU GPL V2 or later
4 # Warranty: NONE
6 # Displays a summary of Subversion working copy changes in ChangeLog
7 # format, plus warnings about any unknown files.
9 # -s for spaces instead of comma separation
10 if [ "$1" = -s ]; then
11 SPACES="set"
12 shift
15 # -q to not print warnings
16 if [ "$1" = -q ]; then
17 QUIET="set"
18 shift
21 status=`svn st $*`
23 # get list of files changed.
24 # remove extraneous text, e.g. ? entries
25 files=`echo "$status" |egrep '^[A-Z]'`
26 # get filenames on one line
27 files=`echo "$files" |egrep -o '[^A-Z].[ ]+(.+)' |xargs`
28 # add commas if -s argument is not given
29 if [ -z "$SPACES" ]; then
30 files=`echo "$files" |sed "s/ /, /g"`
33 # show modifications
34 if [ -n "$files" ]; then
35 echo 'Changes:'
36 if [ -z $SPACES ]; then
37 files="${files}:"
39 # indent and wrap
40 OUTFILE=/tmp/fmt
41 echo -n ' '$files | fmt -w 72 >$OUTFILE
42 # put ' * ' for first line
43 cat $OUTFILE | sed '1s/ / * /'
44 else
45 echo 'No changes.'
48 # warn about anything that isn't a modification or addition
49 if [ -n "$QUIET" ]; then
50 exit
52 warn=`echo "$status" |egrep '^[^MA]'`
53 if [ -n "$warn" ]; then
54 echo 'Warnings:'
55 echo $warn
56 else
57 echo 'No warnings.'