[MERGE][RFC] Enhanced hooks

Aaron Bentley aaron at aaronbentley.com
Wed Feb 6 04:10:00 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
>>>>>> "Ian" == Ian Clatworthy <ian.clatworthy at internode.on.net> writes:
> Hook signatures seems the most blocking problem. I can't imagine
> passing more than a list of strings to a shell script and even
> there we may hit some shell limits.

You can also pass in environment variables, and this makes it simpler to
add new ones and deal with variadic results.

That was the way Arch did it, and frankly, I think it had better hook
capabilities than Bazaar.  Not more powerful, just more useful.

> That means post_pull and post_push are already excluded, their
> signature is a [Pull|Push]Result object...

I think that's an overly mechanical approach.  There's plenty of string
data in a Result.

> IMHO, this limitation restrict shell hooks use to cases where:
> - the script gives back nothing,

Sorry, I don't understand why.

> - we may even ignore errors (or may be not for pre_commit ?),

No, I would expect at least some hooks to respect status codes.

> I agree with that, bzr commands should be atomic and as such
> wrapping them in scripts should address most needs.

I disagree.  I want to hook operations, not commands.  If I want to hook
the fetch operation, then I want to hook push, pull, branch, and
anything else that uses it.

> The only cases where most users may want a hook is pre_commit or
> post_commit ones and mostly because their workflow may be unclear
> when migrating from centralized to decentralized.
> 
> So may be some patterns should be extracted from existing
> plugins like bzr-email and bzr-pqm to make it easier to address
> yet-unknown needs.

These are good, but IMO they aren't an adequate reaction to the
question, "Do you support shell hooks."  The only adequate reaction is
"yes."

>     >> It will just be too freaking hard to make it ROCK like
>     >> in-process stuff does.

For the average user, the in-process stuff is a swiss-army chainsaw.
People don't want to learn Python and the Bazaar API and write a plugin.
 They just want to write a shell script that runs "make lint" before
committing.

I agree entirely that it won't ROCK like the in-process stuff does.  I
don't think it needs to.  I'm absolutely fine with requiring Python for
advanced hooks.

This all smacks of absolutism, but I want Bazaar to be a joy to use for
everyone who uses it.  I think there's a large group of people who don't
want to use Python for simple hook scripts.  And frankly, that group
includes me.

> Making different languages communicate efficiently is a damn hard
> problem and is generally done to gain either better performances
> or more capabilities. Shell can't give us either.

I don't agree, and I would point out that these scripts can be in any
language, not just Bash.  An all-Ruby project might find it very
convenient to be able to call into their library from a hook.  They
might even unit-test it.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHqTMY0F+nu1YWqI0RAnncAJsFnqwd4q4WNuhhVvRUS0rGWPu5NACfX0mP
z53Q+OwpEzucjYJ0e43UPFU=
=deD4
-----END PGP SIGNATURE-----



More information about the bazaar mailing list