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

Re: Hook Files Question

From: David Weintraub <qazwart_at_gmail.com>
Date: Sun, 16 Aug 2009 01:32:21 -0400

Not too sure how you do this with Batch on Windows, but in Unix, the "$$" is
the process ID number of the current process.

We use this to help keep temporary file names unique on Unix systems. For
example:

echo "This is a test" > tempfile.$$.

If the Process ID was 2392, the temporary file name would be tempfile.2392.

Not too sure how this would be done in Windows batch. However, maybe you
could append the transaction number onto the name of the temporary files. I
believe this would be unique on each transaction if multiple transactions
are operating at once. Since the Transaction number is passed to your
script, it should be pretty easy to use:

set TXT=%2

echo "This is a test" > tempfile.%TXT%.txt

Or, something like that.

Truth be known, you're probably better off not using batch scripting. Batch
scripts are very limited language wise. There are few looping control
structures, etc. You have more control if you use something like Python or
Perl for your hook scripts.

The good thing is that hook scripts only run on the server, so you only need
to install Python or Perl on your server. In other revision control systems
like ClearCase, the hook scripts run on the client machine which means that
you have to make sure each client has your scripting language installed on
it.

On Sat, Aug 15, 2009 at 11:36 PM, Jake Stone <jake.the.stone_at_gmail.com>wrote:

> Hello!
>
> I am running Subversion via Apache on Windows, and am writing a few
> batch script hooks, to do simple things like enforce a non-empty log
> message. To do some of these tasks, I create (and overwrite) small text
> files in the hooks directory, such as "email.txt" or similar.
>
> I'm wondering about what might happen if while Person A is making Commit
> A, another Person B will try to start Commit B. Since Subversion is
> atomic, I do not have to worry about any commit B starting before commit
> A is done, correct? In other words, these batch file hooks cannot step
> on each other using common file names, because each commit finishes
> before the next begins, correct?
>
> Thanks for the help!
> Jake Stone
>
> ------------------------------------------------------
>
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2383973
>
> To unsubscribe from this discussion, e-mail: [
> users-unsubscribe_at_subversion.tigris.org].
>

-- 
David Weintraub
qazwart_at_gmail.com
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2383988
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-08-16 07:33:14 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.