You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Dassi, Nasser" <ND...@141xm.com> on 2005/01/21 20:42:41 UTC

RE: Commit hooks malfunctioning... Bug?!

Apology accepted :o)

Any remarks to the following overlooked email?

[snip]
The "bug?" may just be my misunderstanding; here it is, in the form of a
question for the Subversion Dev Team to give a crack at it:

Q: Is it possible for a HOOK (start/pre/post-commit) to access WC
Add/Delete commands (via "svn add" and "svn delete")?

Bkgnd: From this thread conversation with Simon Martel, it appears that
a HOOK *cannot* modify the working copy from which it was instantiated.
Running hook scripts *outside* of a WC "svn commit" command is not a
problem; but based on the WC's "commit" it seems to not execute
ADD/DELETE commands.  "svn up" works fine from within a hook script,
though.

In the end, it may not be a "bug" but a limitation of architecture.  If
so, then I will just schedule the hook script as a cron-job on the
machine.

Thanks.
[/snip]


Nasser Dassi
Sr. Technical Programmer 
=========================================
E: ndassi@141xm.com
=========================================

-----Original Message-----
Subject: Re: Commit hooks malfunctioning...

Simon Comeau Martel <ma...@videotron.ca> writes:
> > In the latter case, the hook program typically does not inherit the 
> > environment of its parent process.  For example, a common problem is

> > for the PATH ($PATH or %PATH, in Unix and Windows respectively) 
> > environment variable to not be set to its usual value, so that 
> > subprograms fail to launch unless invoked via absolute path.  If 
> > you're having unexpected problems with a hook program, the culprit 
> > is probably unusual (or missing) environment variables like PATH.
> 
> Well, if 'svn status' run correctly, the problem with 'svn add' can't 
> be the PATH...

Ah, I missed that part, sorry.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Commit hooks malfunctioning... Bug?!

Posted by Ryan Schmidt <su...@ryandesign.com>.
On 21.01.2005, at 02:57, Dassi, Nasser wrote:

> 1. svn status > random.txt    (Works)
> 2. cscript blah.vbs           (Runs -> creates a file, random1.txt)
> 3. svn add --targets random1.txt    (Fails)
> 4. del random.txt             (Works)
> 5. del random1.txt            (Works)


On 21.01.2005, at 21:42, Dassi, Nasser wrote:

> The "bug?" may just be my misunderstanding; here it is, in the form of 
> a
> question for the Subversion Dev Team to give a crack at it:
>
> Q: Is it possible for a HOOK (start/pre/post-commit) to access WC
> Add/Delete commands (via "svn add" and "svn delete")?
>
> Bkgnd: From this thread conversation with Simon Martel, it appears that
> a HOOK *cannot* modify the working copy from which it was instantiated.
> Running hook scripts *outside* of a WC "svn commit" command is not a
> problem; but based on the WC's "commit" it seems to not execute
> ADD/DELETE commands.  "svn up" works fine from within a hook script,
> though.


Yes, that's what I understand from reading The Book:

http://svnbook.red-bean.com/en/1.1/ch05s02.html

> Warning
>
> Do not attempt to modify the transaction using hook scripts. A common 
> example of this would be to automatically  set properties such as 
> svn:eol-style or svn:mime-type during the  commit. While this might 
> seem like a good idea, it causes  problems. The main problem is that 
> the client does not know  about the change made by the hook script, 
> and there is no way  to inform the client that it is out-of-date. This 
>  inconsistency can lead to surprising and unexpected  behavior.
>
> Instead of attempting to modify the transaction, it is  much better to 
> check the transaction in  the pre-commit hook and reject the commit  
> if it does not meet the desired requirements.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org