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

RE: Previous transaction name in pre-commit script?

From: Sas Janusz <j.sas_at_teta.com.pl>
Date: 2007-11-21 10:00:49 CET

> -----Original Message-----
> From: Ryan Schmidt [mailto:subversion-2007b@ryandesign.com]
> Sent: Wednesday, November 21, 2007 5:14 AM
> To: Sas Janusz
> Cc: users@subversion.tigris.org
> Subject: Re: Previous transaction name in pre-commit script?
>
> On Nov 20, 2007, at 04:54, Sas Janusz wrote:
>
> > SET REPOS=%1
> > SET TXN=%2
> > FOR /F "tokens=1,2 delims= " %%i IN ('svnlook changed %REPOS%') DO (
> > ECHO %%j %TXN%> E:\check-file.txt
> > )
> > EXIT 0
>
> Don't you need 'svnlook changed %REPOS% -t %TXN%'?
>
> I would think you'd also need the full path to svnlook, since
> hooks are supposed to run with an empty environment, hence
> they shouldn't be able to find svnlook or any other
> executable on their own.
>
>

> Don't you need 'svnlook changed %REPOS% -t %TXN%'?

You are right! Thanks a lot. Now it seems obvious. (I was watching and
just couldn't see.)

> hooks are supposed to run with an empty environment

Well, the doucmentation
(http://svnbook.red-bean.com/en/1.4/svn.reposadmin.create.html#svn.repos
admin.create.hooks) claims the same: "For security reasons, the
Subversion repository executes hook programs with an empty
environment-that is, no environment variables are set at all, not even
$PATH (or %PATH%, under Windows). "
Strange! The command shouldn't work at all. Since it does, I have added
1 line to my test pre-commit script, and now it looks this way:

SET REPOS=%1
SET TXN=%2
FOR /F "tokens=1,2 delims= " %%i IN ('svnlook changed %REPOS% -t %TXN%')
DO (
    ECHO %%j %TXN%> E:\check-file.txt
)
ECHO PATH:%PATH%>> E:\check-file.txt
EXIT 0

After committing some changes, the file E:\check-file.txt contained the
full list of directories to search in, including 'C:\Program
Files\Subversion\bin'. The environment doesn't look empty at all.
Probably there is another obvious fact that I miss. However, I am going
to add full paths to avoid any potential problems.

Once again - thank you!!

Janusz

TETA S.A.
Al. Wisniowa 1, 53-137 Wroclaw
http://www.teta.com.pl
tel. +48.71.323.40.00, fax: +48.71.323.40.01
NIP: 897-000-94-77

Sad Rejonowy dla Wroclawia-Fabrycznej we Wroclawiu,
VI Wydzial Gospodarczy, KRS nr 0000111682
Kapital akcyjny i wplacony: 9 000 000 zl

BPH PBK S.A. Wroclaw
Nr rachunku: 62 1060 0076 0000 3210 0004 8734

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Nov 21 10:02:07 2007

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.