You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jo...@sungard.com on 2011/11/22 00:54:24 UTC

Template for Post Commit Hook Script to Get Files

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.

Thanks.

Joe

Joe Floeder • Consultant/Architect • SunGard • InTrader • 601 Second Avenue South, Hopkins, MN 55343 
Tel +952 939 8418 • Fax +952 939 8494 • joe.floeder@sungard.com • www.sungard.com/intrader

CONFIDENTIALITY:  This email (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited.  If you received this email in error, please notify the sender and delete this email from your system.  Thank you

     

Re: svnlook changed

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Dec 30, 2011, at 14:27, <Jo...@sungard.com> <Jo...@sungard.com> wrote:

> I am trying to figure out a way to get a list of files that have changed in a particular code line (branch or project) since a date or a revision.  Svnlook changed does not appear to accept a range of revisions. 
> 
> gold:/opt/subversion-1.7.1/bin> svnlook changed -r11034:11035 /dsi/subversion/test17/itrepos
> svn: E205000: Invalid revision number supplied
> gold:/opt/subversion-1.7.1/bin> svnlook changed -r11034:HEAD /dsi/subversion/test17/itrepos
> svn: E205000: Invalid revision number supplied
> gold:/opt/subversion-1.7.1/bin> svnlook changed -r11034 /dsi/subversion/test17/itrepos
> UU  13.007/p.dev/buildTrade.p
> 
> Am I using the wrong syntax?  Is there a better way to get this information?
> 
> I suppose I could write a script that would recursively use svnlook on a series of revision numbers to build a complete list of changed paths between a selected revision and the HEAD revision of the repos.

Try "svn diff --summarize". For example here is a list of the files and directories changed in the 2.0 branch of MacPorts in December (apologies if my email client inserts any erroneous linebreaks):

$ svn diff --summarize https://svn.macosforge.org/repository/macports/branches/release_2_0 -r{2011-12-01}:{2011-12-31}
M       https://svn.macosforge.org/repository/macports/branches/release_2_0/base/src/pextlib1.0/tests/curl.tcl
M       https://svn.macosforge.org/repository/macports/branches/release_2_0/base/src/pextlib1.0/curl.c
 M      https://svn.macosforge.org/repository/macports/branches/release_2_0/base
 M      https://svn.macosforge.org/repository/macports/branches/release_2_0



svnlook changed

Posted by Jo...@sungard.com.
I am trying to figure out a way to get a list of files that have changed in a particular code line (branch or project) since a date or a revision.  Svnlook changed does not appear to accept a range of revisions. 

gold:/opt/subversion-1.7.1/bin> svnlook changed -r11034:11035 /dsi/subversion/test17/itrepos
svn: E205000: Invalid revision number supplied
gold:/opt/subversion-1.7.1/bin> svnlook changed -r11034:HEAD /dsi/subversion/test17/itrepos
svn: E205000: Invalid revision number supplied
gold:/opt/subversion-1.7.1/bin> svnlook changed -r11034 /dsi/subversion/test17/itrepos
UU  13.007/p.dev/buildTrade.p

Am I using the wrong syntax?  Is there a better way to get this information?

I suppose I could write a script that would recursively use svnlook on a series of revision numbers to build a complete list of changed paths between a selected revision and the HEAD revision of the repos.

Thanks 

Joe Floeder



Re: Template for Post Commit Hook Script to Get Files

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Nov 21, 2011, at 17:54, <Jo...@sungard.com> <Jo...@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:

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).