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

David Roundy droundy at abridgegame.org
Fri Mar 4 14:12:12 UTC 2005

On Thu, Mar 03, 2005 at 11:46:20AM -0500, Phil Frost wrote:
> On Thu, Mar 03, 2005 at 08:55:32AM -0500, David Roundy wrote:
> > They are indeed planned.  It just requires someone taking the time to
> > actually implement them.  They won't even be hard, it just requires adding
> > a --post-hook flag to all darcs commands, and then you'd set it in your
> > defaults.
> > 
> > There's even a wishlist bug on the subject...
> It is good to know a better solution is planned. I imagine I can
> implement a less clean solution until then.
> 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).

> The best idea that comes to mind is to run 'darcs changes -s' and
> compare the output of that to the output from the last commit. This is
> really, really ugly though. Is there a better way?

Yeah, although you might want to give it a --last n argument, if you can
assume that no more than n patches will be pushed at one go.
David Roundy

More information about the darcs-users mailing list