I have a post commit hook that will save the svn log as an XML file.Next i have to do formatting for showing the data in the form of a tabular report that will have the following details:
1)Work Order NO
2)Filename
2)Filepath
3)Revision No.
4)Owner
5)Commit Time
This report needs to be send to a group everyday at 5 PM via email.
I need some sample code for help.
It all depends upon the language you’re using.
Many languages have modules for reading XML files. For example, Perl has the XML::Simple module.
If this is a daily report that you need for your Subversion repository at 5pm every day, you’re better off simply running the report once at 5pm using some sort of scheduling software. On Unix systems, you could use the cron daemon to schedule your system to run a script. On Windows, you can use the Schedule Task Wizard.
Running the report can be very simple. All you need is something like this:
You have to calculate what
$YESTERDAYis and put it inYYYYMMDDformat, and you have your report!How do you get yesterday’s date? Depends upon your programming language. Most operating systems store dates as the number of seconds from an epoc (In Unix, it’s January 1, 1970). You use your programming language’s date routines.
This would be listed in change set order with a list of of the files changed under each change set. If you need a different format, you could use the
--xmlswitch, and get the report in XML format. The format for this XML output is pretty straight forward, and is so regular in structure that you could even parse it without using an XML parsing module.I can’t really give you much help beyond this. I don’t know the OS, the language you use, or even exactly what you need in your report. All that I can tell you is that you don’t need a post-commit hook — just run the
svn logat the appropriate time with the right parameters, and in minutes, you have your report all ready to mail out.And, since this is using
svn, all you need is the Subversion client. You don’t even have to produce this report on a particular machine as long as that machine has a Subversion command line client (downloadable from many places) and someway to specify when the report can be run.