[issue2204] The notify extension reads its config file unnecesarily (for sources which are not configured to trigger a notification)

didlybom bugs at mercurial.selenic.com
Fri May 21 08:55:20 UTC 2010


New submission from didlybom <didlybom at gmail.com>:

I have recently started using the notify extension for mercurial, which is
great, but I believe that I have found a small bug.

The problem that I found is that the notify extension always checks for the
existence of the notify “config” file, even when the action that you are
performing is not configured to perform a notification for a particular
action (such as serve, push, pull, etc) through the notify/sources setting.

For example, if I configure the notify extension in my mercurial.ini as follows:

    [extensions]
    hgext.notify =

    [hooks]
    changegroup.notify = python:hgext.notify.hook

    [notify]
    sources = push
    test = False
    config = \\remote_server\Mercurial\notify\notify.conf.txt

And then I perform an “hg pull”, the notify extension will check whether the
notify.conf.txt file exists, despite the fact that it the extension should
not perform a notification on "pull".

I noticed this because if the configuration file does not exist an error is
shown when performing “hg pull”:

    C:\repositories\local_repo> hg pull
    searching for changes
    adding changesets
    adding manifests
    adding file changes
    added 4 changesets with 2 changes to 3 files
    error: changegroup.notify hook raised an exception: [Errno 2] No such
file or directory: '\\\\remote_server\\Mercurial\\notify\\notify.conf.txt'
    (run 'hg update' to get a working copy)

Normally this is not a big problem at all. However, if the notify
configuration file is placed on a remote server (as in my case) and the
server or the network connection is slow this can add a significant delay to
many of the mercurial operations.

So I think that it would make more sense if the extension first checked
whether it must be triggered, and only when it must it should try to read
the configuration file.

By the way, the reason why we place the configuration file in a remote
server is so that it can be shared by several developers which can then
modify it whenever they want to get notified when something changes in one
of the shared repositories, which are shared through a shared network drive
(i.e. there is no remote hg server running).

----------
messages: 12613
nosy: didlybom
priority: bug
status: unread
title: The notify extension reads its config file unnecesarily (for sources which are not configured to trigger a notification)
topic: notify

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2204>
____________________________________________________


More information about the Mercurial-devel mailing list