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

Jamie Webb j at jmawebb.cjb.net
Fri Mar 4 14:52:39 UTC 2005


On Fri, Mar 04, 2005 at 09:12:12AM -0500, David Roundy wrote:
> > However, the second half of the problem is still unanswered, how do I
> > know what has changed? Because I always commit by sending mail to a
> > magic user, I will run my notification program then. However, I need
> > some way to get some description of the new patches, and what files they
> > have changed.
> 
> That's a good question.  It hadn't occurred to me that the post-hook
> command should get some sort of input.  Hmmmm.  That input probably should
> be something like a summary of what the command did, but it's not clear
> exactly what information should be included, or in what format.  As you
> say, for commit emails you'd like to see something like the output of
> 
> darcs annotate -p . -s
> 
> for each patch that was applied/pulled/whatever.  But that's not terribly
> machine-parseable, and if nothing else, you want the hook scripts to be
> easy to write.  :(  We could have separate --post-hook-human-readable and
> --post-hook-xml commands.  Or yet another flag --hook-data-xml, which
> determine the input passed to the --post-hook flag.  On the whole, it's not
> so simple as I had been imagining (i.e. just call the hook).

I'd suggest that the script should receive the darcs command line and
a list of affected patches, i.e.

darcs push -a host:repo

Runs something like:

hook-command "\
20050225154102-58bca-163725bb863bfee5299677cf0d58b4c44dacb373.gz \
20050225154133-58bca-c4ed7dcd969c16e2eea4ce0d620e26abd461db99.gz" \
push --all host:repo

The patch hashes are sent as a single parameter with embedded spaces,
so it's easy to do something like:

#!/bin/sh
(
	echo "To: me at mywork.com"
	echo "Subject: darcs $2"
	for x in $1
		do darcs annotate --match "hash $x" -s
		echo
	done
) | sendmail -t

Or, maybe the hashes should be passed through stdin to work around
systems with stupidly short command line lengths. Just replace $1 with
`cat`.

-- Jamie Webb




More information about the darcs-users mailing list