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

Re: post-checkout hook

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 29 Apr 2014 10:53:08 +0100 (BST)

Hi, Dean.

Thanks for your mail.

> Our procedure is to:
> 1) svn checkout a version of our code on a normal system
> 2) move the working folder to another system where subversion is not available
> 3) compile and run our code on the new system
>
> The problem is we dont know the version of the code when we are on the 2nd system
> We have a checked in .bat script which will generate a txt file in the working
> folder with version info when run on the 1st system, but now the person who does
> the checkout must remember to run the script [...]
>
> It would be great to have a post-checkout hook that would automatically run the script

So 'svn checkout' could automatically run a user-defined script after it finishes checking out? That's a well known idea, and there are several reasons why that has not been provided, not least of which is it's very simple to write your own script that runs 'svn checkout' followed by your existing version-determining batch script. Is that approach unreasonable for you?

When you say "Security issues are involved" is that code-speak for "The managers will let us install and run 'svn' but they won't let us install a little batch script which calls 'svn'"? (No offence meant, but that's what it sounds like to me.)

A brief mention of some other possible options. Subversion supports server-side hooks for write operations, as you presumably know, but it doesn't sound like you're looking for a server-side action. Anyway, there are no plans for server-side hooks for read operations [1]. TortoiseSVN supports client-side hooks [2] on a few operations including 'update', which you might be able to use instead of 'checkout', but I can't imagine having to run TortoiseSVN instead of 'svn checkout' is any better than having to run the script I suggested instead of 'svn checkout'. Subversion supports keyword substitution [3] so you could have a text file in which the '$Revision: X' is automatically set upon checkout to the revision number in which *this* file last changed, if you can arrange to have such a file that's always changed when a new version of your project is committed.

p.s. Questions like this are preferred on the 'users@' mailing list, reserving 'dev@' for bug reports and design / development. [4]

Regards,
- Julian

[1] http://stackoverflow.com/questions/804970/is-there-a-subversion-checkout-hook-or-something-similar

[2] http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-settings.html#tsvn-dug-settings-hooks

[3] http://svnbook.red-bean.com/en/1.7/svn.advanced.props.special.keywords.html

[4] http://subversion.apache.org/mailing-lists.html
Received on 2014-04-29 11:56:40 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.