You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2001/08/08 21:40:55 UTC

why lines of hooks?

Euh... I don't understand why the repos/conf/*.txt files are *text* files
containing lists of programs to invoke for the hooks. Why aren't they simply
shell scripts? IOW, why the indirection?

If the repos/conf/ files are simple shell scripts, with $1 and $2 and
whatnot as the arguments, then they can invoke any number of further
programs or scripts.

That would simplify a bunch of code, reduce the "semantic overhead" of the
hooks, etc.

Is there a specific reason for the current setup? Or just following the
legacy of CVS? :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

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

Re: why lines of hooks?

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Aug 08, 2001 at 05:17:06PM -0500, kfogel@collab.net wrote:
> Greg Stein <gs...@lyra.org> writes:
> > Euh... I don't understand why the repos/conf/*.txt files are *text* files
> > containing lists of programs to invoke for the hooks. Why aren't they simply
> > shell scripts? IOW, why the indirection?
>...
> I simply didn't think of it -- you're right, it's legacy. :-)
> 
> Your idea is lovely, we should do it.  I think it's probably a
> _really_ change, too, just a matter of losing some code.  I'll look
> into it tomorrow and likely do it, unless there's some unexpectedly
> complicated side-effect.

Cool!

> We don't even need to insist that they be shell scripts, they'll just
> be programs that are passed certain arguments in a certain order.
> We'll ship with shell scripts there by default, with explanatory
> comments in them.  The scripts names will be `pre-commit',
> `post-commit', etc.  Most users will just add stuff to the scripts,
> but really ambitious sites can replace them wholesale.

Right-o.

Back to coding...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

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

Re: why lines of hooks?

Posted by kf...@collab.net.
Okay, thanks!  (Sounds good to me, thoughts from others welcome, but
send 'em quick, 'cause I'm gonna write this soon. :-) )

-K

"Paul D. Smith" <pa...@nortelnetworks.com> writes:
> %% kfogel@collab.net writes:
> 
>   k> We don't even need to insist that they be shell scripts, they'll just
>   k> be programs that are passed certain arguments in a certain order.
> 
> You might want to avoid depending on particular ordering.  In my
> experience, this can make upgrades more painful than necessary.
> 
> Passing arguments as command line options (e.g. use "-flag1 value1
> -flag2 value2" instead of order-specific "value1 value2") is quite a bit
> more flexible, since you can add more options and even remove obsolete
> ones, and old scripts will continue to work (unless they used the
> removed option of course).
> 
> Also consider using the environment... that's very flexible as well and
> if you have lots of constant data it can save some work (you can have
> one function that sets the environment properly, then invokes the
> command).
> 
> -- 
> -------------------------------------------------------------------------------
>  Paul D. Smith <ps...@baynetworks.com>    HASMAT--HA Software Methods & Tools
>  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
> -------------------------------------------------------------------------------
>    These are my opinions---Nortel Networks takes no responsibility for them.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

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

Re: why lines of hooks?

Posted by "Paul D. Smith" <pa...@nortelnetworks.com>.
%% kfogel@collab.net writes:

  k> We don't even need to insist that they be shell scripts, they'll just
  k> be programs that are passed certain arguments in a certain order.

You might want to avoid depending on particular ordering.  In my
experience, this can make upgrades more painful than necessary.

Passing arguments as command line options (e.g. use "-flag1 value1
-flag2 value2" instead of order-specific "value1 value2") is quite a bit
more flexible, since you can add more options and even remove obsolete
ones, and old scripts will continue to work (unless they used the
removed option of course).

Also consider using the environment... that's very flexible as well and
if you have lots of constant data it can save some work (you can have
one function that sets the environment properly, then invokes the
command).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <ps...@baynetworks.com>    HASMAT--HA Software Methods & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.

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

Re: why lines of hooks?

Posted by kf...@collab.net.
Greg Stein <gs...@lyra.org> writes:
> Euh... I don't understand why the repos/conf/*.txt files are *text* files
> containing lists of programs to invoke for the hooks. Why aren't they simply
> shell scripts? IOW, why the indirection?
> 
> If the repos/conf/ files are simple shell scripts, with $1 and $2 and
> whatnot as the arguments, then they can invoke any number of further
> programs or scripts.
> 
> That would simplify a bunch of code, reduce the "semantic overhead" of the
> hooks, etc.
> 
> Is there a specific reason for the current setup? Or just following the
> legacy of CVS? :-)

I simply didn't think of it -- you're right, it's legacy. :-)

Your idea is lovely, we should do it.  I think it's probably a
_really_ change, too, just a matter of losing some code.  I'll look
into it tomorrow and likely do it, unless there's some unexpectedly
complicated side-effect.

We don't even need to insist that they be shell scripts, they'll just
be programs that are passed certain arguments in a certain order.
We'll ship with shell scripts there by default, with explanatory
comments in them.  The scripts names will be `pre-commit',
`post-commit', etc.  Most users will just add stuff to the scripts,
but really ambitious sites can replace them wholesale.

Thanks!

-K

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