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

Re: Getting SVN URL in Precommit hook

From: David Weintraub <qazwart_at_gmail.com>
Date: Wed, 29 Apr 2009 15:26:55 -0400

On Wed, Apr 29, 2009 at 7:57 AM, <Sunil.SHARMA_at_rbs.com> wrote:
> I am trying to create a utility that checks before every commit if there is
> a file present in the base path of the repository on the server. For this I
> need to know if there is any mechanism to get the url for the svn path I am
> commiting to in my pre commit hook utility?

So, are you looking for a particular file in the root of the repository?

If you're looking for a particular file, you can use "svnlook cat" or
"svnlook info" to see if the file exists. If the file exists, both of
these commands will return a "0". Otherwise, they'll return a non-zero
value.

The first argument given to your hook script is the location of the
repository. The second argument is the transaction number of the
commit. The svnlook command takes these both as arguments in almost
all of the sub-commands.

If you're looking to see if any file is present in the root of the
repository, then you can use the "svnlook -t $TXNO -N tree $REPOS .
command and parse its output. Directories names end in a "/". File
names don't.

-- 
David Weintraub
qazwart_at_gmail.com
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1984220
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-04-29 21:31:49 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.