So far as I know setpref is the only supported means to set the test "hook". 
For parity, it would make sense to be able to add it as a file in _darcs/prefs, 
but I don't recall if that is possible. Again, test/setpref are the oldest 
extension mechanism in darcs predating pre-/post-hooks by years. In some ways 
setpref may as well be deprecated as it is also the most complicated of 
extension points in Darcs: It creates patches and thus needs to commute them... 
A fine idea in theory, but a lot of leg work to handle what should be "easy 
extension points". (If Darcs had a low level, structured patch type like JSON 
trees or similar, you could imagine a world where things like setpref would be 
easier to implement and more commonly used... setpref itself is just too 
bespoke to be easily extended.)

The darcs test command runs the chosen test runner ("hook") alone. The --test 
flags run the test runner as a part of the command flow, essentially running as 
"mid-hook" as was being sought in this thread.

Does that help? (Please excuse my tangential meanderings above.)

Also, keep in mind most of my knowledge on this topic is as a long-time Darcs 
user and occasional documentation contributor...

Sent from my wireless telegraph. Full stop.
________________________________
From: Ben Franksen<mailto:ben.frank...@online.de>
Sent: ‎5/‎31/‎2014 14:56
To: darcs-users@darcs.net<mailto:darcs-users@darcs.net>
Subject: Re: [darcs-users] Return value of hooks

Max Battcher wrote:
> Darcs test was build specifically for this. It might be worth adding a
> note under pre/post-hooks in the manual that Darcs test exists as a
> "mid-hook" in record. As it stands the documentation to figure it out is
> spread through Darcs test, Darcs record, and Darcs setpref.
>
> Darcs test predates pre-/post-hooks, which should explain why it feels so
> different/is documented so different.

Ok, can we clarify: is this the "darcs test" command, or is it "darcs
<command> --test"? Or something else?

Is the darcs setpref necessary or can I also specify a test with a command
line switch?

Cheers
Ben

> Sent from my wireless telegraph. Full stop.
> ________________________________
> From: Ben Franksen<mailto:ben.frank...@online.de>
> Sent: ‎5/‎29/‎2014 17:48
> To: darcs-users@darcs.net<mailto:darcs-users@darcs.net>
> Subject: Re: [darcs-users] Return value of hooks
>
> Dmitry Bogatov wrote:
>> It seems, that I can set {pre,post} -hooks for record command, but
>> I cannot find a way to use their exit status.
>
> Well, darcs commands fail immediately if the pre-hook failed. They also
> "fail" (that is, return the same exit code) if the post-hook failed.
>
> However, this is of no use to you, since the pre-hook is run before the
> command even starts asking you which changes you want to record. And the
> post-hook may fail, and darcs may return the same exit code, but now it is
> too late: the changes to the repository are already made, and darcs does
> not roll back these changes.
>
>> What I want, is get `darcs record` to ask me to choose chunks, apply
>> them, run test and refuse to record, if it fails. Is it possible?
>
> That is, you want a post-hook that, if it fails, causes darcs to roll back
> any changes it might have made.
>
>> PS. Sorry for possible duplicate
>
> I don't think this came up before. It would be a nice feature, but it
> would also need some serious re-factoring to implement it.
>
> As for work-arounds:
>
> There is darcs unrecord. You can wrap your post-hook into a script that
> checks for the failure, then unrecords the patch that just got recorded.
> If you want to make this more fail-safe, add a pre-hook that creates a tag
> with some unique name, then in case of a post-hook failure, unrecord
> everything up to and including this tag.
>
> Cheers
> Ben
> --
> "Make it so they have to reboot after every typo." -- Scott Adams
>
>
> _______________________________________________
> darcs-users mailing list
> darcs-users@darcs.net
> http://lists.osuosl.org/mailman/listinfo/darcs-users
--
"Make it so they have to reboot after every typo." -- Scott Adams


_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users
_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to