Configuring the Notify extension
Simon King
simon at simonking.org.uk
Wed Oct 12 20:05:02 UTC 2016
I don’t know what is causing the “Access denied” error in the first configuration. Do you still get that error if you disable the notify extension altogether? How about if you set “test = True” in the [notify] section?
The [notify] “config” setting in mercurial.ini would need to be a local filename (on the server) - it can’t be a URL. So it might be something like “C:\repos\AnotherRepo\subscribers.txt”, where “C:\repos” would be replaced with whatever path contains AnotherRepo. However, I would guess that if you get this working, you’ll just be back to the “Access denied” error again.
Running mercurial behind IIS makes debugging a bit more difficult. I would suggest that you start by running “hg serve” from a command prompt on the server, and pushing to that process. If you still get "Access denied”, and there’s no useful output on the server command-line, try adding “--verbose --traceback” to the “hg serve” command.
If it works when pushing to “hg serve”, but not when mercurial is running under IIS, I would guess that the user account running IIS doesn’t have appropriate permissions on the repository.
Let us know how you get on,
Simon
> On 12 Oct 2016, at 16:46, Reg Valgardena <rvalgardena at ymail.com> wrote:
>
> Hi Simon,
>
> thanks a lot for your answer and the link to the wiki page; without it, it is quite difficult to find information (I was unable to).
>
> In between, I have already figured out a couple of things, and notification did tentatively function once. Now it does not do again, and the question is what is different now.
>
> My remote repository (the repo into which I push) is installed on a remote server ('https://h1234567.stratoserver.net/hg/') as a web service under IIS 7 (Windows 2012).
>
> In the test repository called 'AnotherRepo' (i.e. in 'https://h1234567.stratoserver.net/hg/AnotherRepo/.hg/') the notify configuration is contained in the 'hgrc' file, namely:
>
> [extensions]
> notify=
>
> [hooks]
> changegroup.notify = python:hgext.notify.hook
> incoming.notify = python:hgext.notify.hook
> outgoing.notify = python:hgext.notify.hook
>
> [usersubs]
>
> rvalgardena at ymail.com
> = *
>
> [reposubs]
> * =
> rvalgardena at ymail.com
>
>
> [email]
> from = No Answer
> <info at something.de>
>
>
> [smtp]
> host = smtp.strato.de
> username =
> myName at strato.de
>
> password = myPassword
> tls = true
>
> [web]
> baseurl =
> http://hgserver/hg
>
>
> [notify]
> sources = serve push pull unbundle
> test = False
> # config =
> https://h1234567.stratoserver.net/hg/AnotherRepo/subscribers.txt
>
>
> template =
> details: {baseurl}/{webroot}/rev/{node|short}
> branches: {branches}
> changeset: {rev}:{node|short}
> user: {author}
> date: {date|date}
> description:
> {desc}\n
>
> maxdiff = 300
>
> I cloned the remote repo to a local folder and started making changes, committing, and pushing them to the remote repo. At first, the server really did send emails (but only to the first email in the list, if there was a comma-separated list, as in the description). After a time, however, something changed and now, I am unable to produce a single email notification, no matter how I try.
>
> More concretely, if the addressee list is directly in the hgrc file, as above, I am getting the following message:
>
> remote: error: incoming.notify hook raised an exception: [Error 5] Access denied
> and if comment out these lines and uncomment the "config" line instead, I am getting
>
> remote: error: changegroup.notify hook raised an exception: [Errno 22] invalid mode ('r') or filename: 'https://h2485635.stratoserver.net/hg/AnotherRepo/subscribers.txt'
>
> I would be greatly thankful for any tip of what could be wrong with my configuration,
>
> Reg
>
> PS. For all cases, both files are attached
>
> On 2016-10-12 16:36, Simon King wrote:
>> On Mon, Oct 10, 2016 at 10:35 AM, Reg Valgardena via Mercurial
>>
>> <mercurial at mercurial-scm.org>
>> wrote:
>>
>>> Hello list,
>>>
>>> I have been trying to understand how to correctly configure the
>>> mercurial.ini file in order to make the "central" repository to notify a
>>> list of participants of an action happened (typically, a push). The
>>> situation is more or less so that a small group of developers push and pull
>>> changesets to and from a "central" repository. It would be great if the HG
>>> server on the central machine would notify each one from the list.
>>>
>>> I tried to understand (and bring to action) the solution described on
>>>
>>> https://www.mercurial-scm.org/wiki/NotifyExtension
>>> , but it seems that I do
>>> not quite understand it.
>>>
>>> First of all, would it be correct to make the changes in mercurial.ini on
>>> the server machine? Client machines? If I am right that it should be the
>>> server, should the "[email] from =" be some email address connected with the
>>> server? And the smtp parameters such that the server can access them? What I
>>> do not understand, that is where the list of the addressees is? There is a
>>> "config = /full/path/to/subscription/file" mentioned, but what should it
>>> look like? A plain list of emails? Comma-separated? Breakline-separated?
>>>
>>> I would be grateful for a working explanation but, better, an example of a
>>> mercurial.ini for this case and the format of the file containing the list
>>> of participants.
>>>
>>> Thanks, RegV
>>>
>>> PS. All machines involved work under Windows (Windows Server 12 and Windows
>>> 10).
>>>
>> If you enable the extension in your mercurial.ini file, "hg help -e
>> notify" will give a more complete reference than is on the wiki. You
>> can also read the source of the help text at
>>
>> https://selenic.com/hg/file/tip/hgext/notify.py#l8
>> .
>>
>> As for *where* you should be configuring it, it depends how you are
>> hosting your central repository. If you push to it over http or ssh,
>> you can configure it all on the server. If it lives on a network
>> drive, you can probably still configure it in the central repository's
>> mercurial.ini, but you'll need to be aware that it is the client
>> machines that are actually running the code.
>>
>> Hope that helps,
>>
>> Simon
>>
>>
>
> <hgrc.txt><subscribers.txt>
More information about the Mercurial
mailing list