Having a problem with pre-commit hook parameters

104 views
Skip to first unread message

David Moll

unread,
Oct 21, 2008, 11:05:05 AM10/21/08
to us...@tortoisesvn.tigris.org
Hi,

I'm trying to set up a pre-commit hook script in TortoiseSVN that will
only allow a commit if the comment matches a regex. Unfortunately I'm
not even getting to the point where I can test the script. Here's
what's happening. I grabbed the script posted on
http://www.anujgakhar.com/2008/02/14/how-to-force-comments-on-svn-commit/
and modified it so the findstr uses Windows pseudo-regex to look for a
certain string.

@echo off
::
:: Stops commits that have empty log messages.
::

@echo off

setlocal

rem Subversion sends through the path to the repository and
transaction id
set REPOS=%1
set TXN=%2

rem check for an empty log message
svnlook log %REPOS% -t %TXN% | findstr . > nul
if %errorlevel% gtr 0 (goto err) else exit 0

:err
echo. 1>&2
echo Your commit has been blocked because you didn't give any log
message 1>&2
echo Please write a log message describing the purpose of your changes
and 1>&2
echo then try committing again. -- Thank you 1>&2
exit 1

svnlook: Can't open file 'C:\DOCUME~1\dmoll\LOCALS~1\Temp\svn67.tmp
\format': The system cannot find the path specified.

My working copy is C:\Source\externalTest
The repository is at C:\SVN

I've looked at the four arguments passed into the script and none of
them would work with the svnlook log command. It seems like the path
passed in as the repository path should not be some temp file buried
in my local settings directory.

I did set the repository up using Tortoise, I don't know if that makes
a difference.

Thanks,

~Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-un...@tortoisesvn.tigris.org
For additional commands, e-mail: users...@tortoisesvn.tigris.org

Milen A. Radev

unread,
Oct 21, 2008, 11:35:41 AM10/21/08
to us...@tortoisesvn.tigris.org
2008/10/21 David Moll <dave...@gmail.com>:

It should not matter. And I can't reproduce it here (creating local
repository with TSVN and all).

You may get more help asking on the general subversion mailing list
(users at subversion.tigris.org).

--
Milen A. Radev

Kurt Pruenner

unread,
Oct 21, 2008, 11:35:43 AM10/21/08
to us...@tortoisesvn.tigris.org
David Moll wrote:
> I've looked at the four arguments passed into the script and none of
> them would work with the svnlook log command. It seems like the path
> passed in as the repository path should not be some temp file buried
> in my local settings directory.

Errr... you're not supposed to use that as a TSVN hook script on the
client side, but as a server-side SVN hook script:

http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks
http://svnbook.red-bean.com/en/1.5/svn.ref.reposhooks.pre-commit.html

As you can see, a server-side pre-commit hook has exactly the two
parameters your script expects.

--
Kurt Bernhard Pruenner --- Haendelstrasse 17 --- 4020 Linz --- Austria
.......It might be written "Mindfuck", but it's spelt "L-A-I-N".......
np: New Order - The Beach (Power, Corruption & Lies Extras)

David Moll

unread,
Oct 21, 2008, 11:53:26 AM10/21/08
to us...@tortoisesvn.tigris.org
> Errr... you're not supposed to use that as a TSVN hook script on the
> client side, but as a server-side SVN hook script:
>
> http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.rep...http://svnbook.red-bean.com/en/1.5/svn.ref.reposhooks.pre-commit.html

>
> As you can see, a server-side pre-commit hook has exactly the two
> parameters your script expects.
>
> --
> Kurt Bernhard Pruenner --- Haendelstrasse 17 --- 4020 Linz --- Austria
> .......It might be written "Mindfuck", but it's spelt "L-A-I-N".......
> np: New Order - The Beach (Power, Corruption & Lies Extras)

D'oh! Thanks Kurt, I knew it had to be something simple that I was
missing. It's working perfectly now.

~Dave

Reply all
Reply to author
Forward
0 new messages