I decided to move the svn-tools repository inside hacks.
Posts Tagged ‘svn’
Update: hacks repository
Tuesday, July 28th, 2009Svn Feed & Svn-tools
Monday, June 1st, 2009Here is a new script for the subversion post-commit hooks.
It creates a rss feed containing information about the latest commit of collection of repositories.
#!/usr/bin/env bash
DESTINATION="/var/www/hacks/svn-feed"
ENTRIES="$DESTINATION/entries"
RSS="$DESTINATION/feed.xml"
TITLE='MLDB: Svn RSS'
LINK='http://matteolandi.no-ip.org/svn-browse'
DESCRIPTION='RSS feeds of the commits'
LAST_BUILD_DATE="`date -R`"
if [ $# -lt 2 ]; then
printf "Usage: $0 path revision\n"
exit 1
fi
REPO="$1"
PROJECT="`basename $REPO`"
REVISION=$2
OLD=$(( $REVISION - 1 ))
TEMP="`mktemp`"
printf "$PROJECT\n" >> $TEMP
svn log file://"$REPO" -r $REVISION >> $TEMP
cat $ENTRIES >> $TEMP
mv $TEMP $ENTRIES
printf "\n" > $RSS
printf "\n" >> $RSS
printf "\n" >> $RSS
printf "\n" >> $RSS
printf "
$LINK\n" >> $RSS
printf "$DESCRIPTION \n" >> $RSS
printf "$LAST_BUILD_DATE \n" >> $RSS
cat $ENTRIES | while read line; do
repo="$line"
read line
read line
revision=`echo $line | cut -d '|' -f 1 | tr -d ' r'`
author=`echo $line | cut -d '|' -f 2 | tr -d ' '`
day=`echo $line | cut -d '|' -f 3 | cut -d '(' -f 2 | cut -d ')' -f 1`
time=`echo $line | cut -d '|' -f 3 | cut -d ' ' -f 3,4`
pub_date="$day $time"
lines=`echo $line | cut -d '|' -f 4 | tr -d ' lines'`
read line
printf "- \n" >> $RSS
printf "\n" >> $RSS
printf "
$author \n" >> $RSS
printf "
$pub_date \n" >> $RSS
printf "" >> $RSS
while read line; do
printf "$line\n" >> $RSS
lines=$(( $lines - 1 ))
if [ $lines -eq 0 ]; then
break
fi
done
printf " \n" >> $RSS
printf " \n" >> $RSS
read line
done
printf " \n" >> $RSS
printf " \n" >> $RSS
I decided to create a repository to collect these svn-hacks: track them under the name svn-tools.