[darcs-users] Return value of hooks

Ben Franksen ben.franksen at online.de
Sat May 31 18:55:45 UTC 2014

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?


> Sent from my wireless telegraph. Full stop.
> ________________________________
> From: Ben Franksen<mailto:ben.franksen at online.de>
> Sent: ‎5/‎29/‎2014 17:48
> To: darcs-users at darcs.net<mailto:darcs-users at 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 at darcs.net
> http://lists.osuosl.org/mailman/listinfo/darcs-users
"Make it so they have to reboot after every typo." -- Scott Adams

More information about the darcs-users mailing list