Questions regarding hooks

Martin Geisler mg at lazybytes.net
Fri Jun 18 06:14:08 CDT 2010


Didly Bom <didlybom at gmail.com> writes:

> On Fri, Jun 18, 2010 at 11:25 AM, Martin Geisler <mg at aragost.com> wrote:
>
> It is true that there is a bit of configuration that you may add to
> the notify extension setup. Nevertheless, most of that configuration
> is shared with other extensions that must use email (such as the
> patchbomb extension). That configuration is easily accessible from GUI
> tools such as TortoiseHg. However, those GUI tools do not give easy
> access to setting up hooks, which I think may be considered "advanced"
> mercurial configuration.
>
> That is why I find that having to manually setup a hook makes it
> harder than it should. In addition you must remember that the hook
> must point to "python:hgext.notify.hook" (funnily enough, you made
> that exact comment later on your email : "# I don't remember the exact
> name of the hook" :-) )

Yeah, I was writing from my phone :-) When you configure the extension
you have the hook name right at hand:

  http://mercurial.selenic.com/wiki/NotifyExtension

There are some comments at the bottom of that page with what I consider
to be more important usability complains. Especially the comment about
the "sources" setting. Is not obvious what the keywords mean there.

>>  [hooks]
>>  changegroup.send-to-me = notify:hook # I don't remember the exact
>> name of the hook
>>
>> and you would have to recognize this somehow.
>
>
> I'd like to use the following function to check whether the user
> manually configured a notify hook:
>
> #--- Begin of python code ---
> def is_notify_hook_manually_configured(ui):
>     '''Return True if a hook to the "notify.hook" function has been
> configured'''
>     b_notify_hook_is_setup = False
>     v_hook_list = ui.configitems("hooks")
>     for v_hook_item in v_hook_list:

This is a nicer way to do this:

          if v_hook_item[1].endswith("notify.hook"):
              return True
      return False

I still don't see the big need for this change, but I think that should
work. Please see the BasicCodingStyle before you submit anything:

  http://mercurial.selenic.com/wiki/BasicCodingStyle

and this page for information on how to actually submit it:

  http://mercurial.selenic.com/wiki/ContributingChanges

-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100618/0dce48b2/attachment.pgp>


More information about the Mercurial-devel mailing list