Re: Template for Post Commit Hook Script to Get Files
From: Ryan Schmidt <subversion-2011a_at_ryandesign.com>
Date: Mon, 21 Nov 2011 18:03:41 -0600
On Nov 21, 2011, at 17:54, <Joe.Floeder_at_sungard.com> <Joe.Floeder_at_sungard.com> wrote:
> I am looking for an example of a post commit hook script that will 'get' a copy of the files that have changed in the revision being committed. The intent is to populate a set of unix directories with the latest version of source code files. These directories are in the "PROPATH" used in our PROGRESS database test systems. I would prefer examples of unix shell scripts but will also take a look at python or perl scripts.
If you maintained a server-side working copy, running "svn update" on that working copy would only pull the changes. But if you really only want the files that have been changed, in order to do something special with them, then a different approach using svnlook may be desirable. You use "svnlook changed" to see what files changed, and you can use "svnlook cat" to extract them from the transaction to do things with them.
There have been a few such scripts posted here over the years. Here's one that tries to do a PHP syntax check on each PHP script committed:
http://svn.haxx.se/dev/archive-2008-01/0277.shtml
Perhaps that's a useful example to start with. This is a pre-commit hook but a post-commit hook is similar (you just deal with a revision instead of a transaction).
|
This is an archived mail posted to the Subversion Users mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.