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

Re: Hook to check for a presence of file before committing

From: David Weintraub <qazwart_at_gmail.com>
Date: Mon, 30 Aug 2010 23:26:27 -0400

On Mon, Aug 30, 2010 at 8:46 PM, Tech Geek <techgeek12345_at_gmail.com> wrote:
>>Perhaps if you explain why you want to check for the existence of this file
>> in the working copy we can help you find a different way of >going about it.
> OK. Let me try to explain this.
> The code that we are trying to commit is generated by an IDE - a software
> development tool. The particular file (project.xml) is usually an optional
> file that is up to the developers/user to generate. However we would like to
> enforce a policy where all the developers before they commit their changes
> make sure that the project.xml is also generated and then only a successful
> commit occurs.
>
> Does this help?

You usually don't commit generated artifacts, but the base source
artifacts that are used to generate your artifacts. For example, is
there a project file that your IDE uses to generate the code? If so,
you may want to commit that instead.

It is possible to verify that a project.xml is one of the files being
committed because you can use "svn changed" at the time of the
transaction to see what files are being added or modified. It would be
possible to fail the transaction if svnlook changed doesn't have a
project.xml file in the list.

I would suggest you use Python or Perl as your hook script language.
One of the advantages of a server side hook is that it only has to run
on a single machine (the server). A scripting language like Python or
Perl is a bit more flexible for writing hooks than Batch or even Power
Shell.

-- 
David Weintraub
qazwart_at_gmail.com
Received on 2010-08-31 05:27:22 CEST

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.