[darcs-users] pre and post commands

David Roundy droundy at abridgegame.org
Mon Nov 15 12:06:21 UTC 2004

On Sun, Nov 14, 2004 at 12:45:12PM +0000, Mark Stosberg wrote:
> I wouldn't mind some standard 'pre' and 'post' hooks to make
> scripting even easier, though.

I've mentioned before that I do think that 'pre' and 'post' hooks to darcs
are a good idea.  They can be configured with the setpref mechanism,
wouldn't be too hard to implement, and would make scripting with darcs
reasonably friendly.

In fact, the implementation of 'pre' and 'post' hooks could be done pretty
cleanly via a modification of the command_prereq mechanism.  You'd have to
change the command_prereq from

command_prereq :: [DarcsFlag] -> IO (Maybe FilePath, String)


command_prereq :: [DarcsFlag] -> ((Maybe FilePath, String) -> IO a) -> IO a

and then modify am_in_repo to run the 'pre' command before executing the
command, and run the 'post' command afterwards (probably using bracket to
guarantee that the 'post' command is run even if there was a failure).
David Roundy

More information about the darcs-users mailing list