#!/usr/bin/perl -w # This file is part of svnlog2rss_xsl # Copyright (C) 2005 Toby Thain, toby@telegraphics.com.au # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # HOW TO USE THIS # This script may be invoked by a Subversion post-commit hook # to produce an XML log of the last N revisions. # Add the following to '/hooks/post-commit': # # /var/svn/_scripts/svn_log_xml.pl "$1" "$2" # # (substituting the correct path to this script; that location # is just an example that happens to be where it lives on my server). use strict; # installed location of 'svn' binary my $SVN = "/usr/bin/svn"; # where XSL documents are stored (typically somewhere in web server tree) my $XSLDIR = "/var/www/localhost/htdocs/xsl"; # login to Subversion server (localhost) my $SVNLOGIN = "--username admin --password XXX"; die "usage: ",__FILE__," REPO_PATH REVISION" unless $#ARGV > 0; my $repo = $ARGV[0]; my $rev = $ARGV[1]; my $start = $rev-15; # only log the last 15 revisions if($start < 1){ $start = 1; } if( $repo =~ /\/([^\/]+)$/ ) { system("$SVN log $SVNLOGIN -v --xml -r $start:$rev http://localhost/svn/$1 > $XSLDIR/$1.xml"); }