You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Dean A Starr <da...@raytheon.com> on 2014/04/25 21:09:08 UTC

post-checkout hook

Hi,

This would be a very nice feature for us.
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
 before doing the laborious copy.  Security issues are involved.

It would be great to have a post-checkout hook that would automatically run
the script

Thanks,
Dean Starr
Raytheon


Re: post-checkout hook

Posted by Julian Foad <ju...@btopenworld.com>.
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


AW: post-checkout hook

Posted by Markus Schaber <m....@codesys.com>.
Hi, Dean,

Von: Dean A Starr [mailto:dastarr@raytheon.com] 
Hi,

> This would be a very nice feature for us.
> 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
>  before doing the laborious copy.  Security issues are involved.

> It would be great to have a post-checkout hook that would automatically run the script

I see great "Security issues" appearing when a checkout automatically runs scripts on my system.

Lots of people checkout from public / "untrusted" repositories (like free software hosted somewhere), I don't want to give those repositories to give the power to execute scripts on my machine.


Best regards

Markus Schaber

CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH 

Inspiring Automation Solutions 
________________________________________
3S-Smart Software Solutions GmbH 
Dipl.-Inf. Markus Schaber | Product Development Core Technology 
Memminger Str. 151 | 87439 Kempten | Germany 
Tel. +49-831-54031-979 | Fax +49-831-54031-50 

E-Mail: m.schaber@codesys.com | Web: codesys.com | CODESYS store: store.codesys.com 
CODESYS forum: forum.codesys.com 

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915