[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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.
> I googled a bit on this and I see a script that in turn calls a Hudson build script but we are not quite ready to do complete system builds. I also think a "bulk" svn export will not work for us either as we really only want the files that have changed in that revision.

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:


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).
Received on 2011-11-22 01:05:01 CET

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.