[darcs-devel] [darcs #90] pre and post commands
David Roundy via RT
bugs at darcs.net
Mon Nov 15 04:08:29 PST 2004
Mon Nov 15 07:08:28 2004: New ticket: 90.
Transaction: Ticket created by droundy
Queue: Darcs
Subject: pre and post commands
Owner: Nobody
Requestors: droundy at abridgegame.org
Status: new
Ticket <URL: http://bugs.darcs.net/.//Ticket/Display.html?id=90 >
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)
to
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
http://www.darcs.net
More information about the darcs-devel
mailing list