[PATCH 1 of 1] hgweb: add support for extension provided check_perm hooks

Sune Foldager cryo at cyanite.org
Mon Nov 9 06:24:17 CST 2009


Dirkjan Ochtman wrote:
>> Is there a reason to separate the hooks? I suppose it would look nicer
>> and it could be easily done, for sure, but either all hooks 'below' in
>> level should be called as well, then, since there are common stuff for
>> all three types, or it's up to the hooks to deal with any common stuff.
> 
> Yeah, it's nice exactly because you can leave the hooks to deal with
> the common stuff. I think it will probably at the very least make the
> default code easier to read/understand.

Actually, the more I think about this the less I like it. Calling the
hook with an operation type gives it maximal flexibility on what to do:
switch into separate cases, do common processing part of the way and
then switch, etc. The built-in default_checkperm (fka. check_perm) does
stuff like that.

I think we should (essentially at least) keep that patch as it is,
introducing a list that extensions can add into. This is the same way
it's done for web-handlers. A more formalized approach may be desirable
later on, perhaps.

/Sune


More information about the Mercurial-devel mailing list