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

David Roundy droundy at abridgegame.org
Sat Mar 5 13:02:45 UTC 2005


On Fri, Mar 04, 2005 at 07:30:37PM -0800, Dave Roberts wrote:
> On Fri, 2005-03-04 at 14:52 +0000, Jamie Webb wrote:
> > I'd suggest that the script should receive the darcs command line and
> > a list of affected patches, i.e.
> 
> You might also want to define a whole bunch of darcs environment
> variables that get set prior to executing the script, sort of like what
> CGI scripts do. It's kludgy but it works and that way you don't have to
> try to guess what somebody will want and try to put it all into the
> command line.

I like this idea, since it's readily parseable, and easily extendable, and
we don't have to worry about "orders" or things like that, and can always
add another environment variable to satisfy someone who wants some
different piece of information.  It may feel kludgy, but it's a tried and
true method, and probably leads to scripts (or one-liners) that are as
simple as you can get.

> The other option is to define a command string that's stores in the repo
> that has $REPO and $PATCH sorts of pseudo variables that get expanded by
> darcs (not the shell and not environment, which may help you on
> cross-platform stuff). That way a user can choose what parameters he
> wants passed to his own scripts and you don't end up with terribly long
> command lines.

This sounds sort of like the first option, or at least complementary.  How
would it sound if we ourselves expanded the environment variables in the
command line? We could use the same namespace as the environment variables,
and do the expansion ourselves.  The only trickiness that I forsee is that
variables like $PATCHNAME might contain shell metacharacters, and we
definitely want to pass the hook command to the shell (rather than straight
to execvp), so that users can write it as a shell script.  Ideally I'd like
to be able to write something like

echo "$PATCH_SUMMARIES" | mail -s "$NUM_PATCHES applied to $REPO" droundy

I'm not sure how the $PATCH_SUMMARIES bit would work, though, since it'd
have embedded newlines.  :(
-- 
David Roundy
http://www.darcs.net




More information about the darcs-users mailing list