[darcs-users] determining what darcs apply did [was: sending notices when a repo changes]

Thomas Zander zander at kde.org
Sun Mar 6 16:54:12 UTC 2005


On Sunday 06 March 2005 15:51, Phil Frost wrote:
> On Sun, Mar 06, 2005 at 12:23:42PM +0100, Thomas Zander wrote:
> > Notice that the strategy chosen there; one script which is called by
> > all hooks with a different argument. Really does not help to make
> > things easier.
> > The env vars idea is used there, and in cvs.  Proven idea; please go
> > for that :)
>
> I think though that it's very important that the command that triggered
> the hook be a parameter to the hook. Thus, one script can be written to
> handle the actions for two commands that are mostly identical but differ
> slightly.

To solve the problem your way I have to either call a script that shares the 
code between these two functions, or I can write a script that calls 
different methods based in the input, creating a 3th method that the two 
commands mostly share.
I'm pretty sure more people know how to start a 3th script then people know 
how to create functions in a script file, meaning that 2 commans can share 
code without your solution.

My point is still that this is not what I like as being a hook:
if test $command = "foo"; then
    # 100 lines of code
    exit
fi
# repeat the above 10 times.

Thats horrible to maintain, very annoying to figure out what is called/when 
and basically not intuitive to new users.
-- 
Thomas Zander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20050306/769b5859/attachment.pgp 


More information about the darcs-users mailing list