Pushing changes to a remote mercurial repo is reporting an error in my changegroup.notify hook. It worked with an old 2.7 release of mercurial, but is broken now.
My server has
Python 3.9, hg --version is
Mercurial Distributed SCM (version 6.3.1)
The relevant repo's hgrc has
changegroup.notify = python:hgext.notify.hook
The hook reports an exception:
>: hg --traceback push
pushing to https://[redacted]
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
remote: error: changegroup.notify hook raised an exception: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
remote: (run with --traceback for stack trace)
Why the exception, when I am using what is supposed to just work out of the box?
Update: Re-ran the test pushing from an account on the same machine as the server (thanks @LazyBadger), got the following traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/mercurial/hook.py", line 116, in pythonhook
r = obj(ui=ui, repo=repo, hooktype=htype, **pycompat.strkwargs(args))
File "/usr/local/lib/python3.9/dist-packages/hgext/notify.py", line 589, in hook
n = notifier(ui, repo, hooktype)
File "/usr/local/lib/python3.9/dist-packages/hgext/notify.py", line 326, in __init__
self.stripcount = int(self.ui.config(b'notify', b'strip'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Solution: Turns out this is the error you get if you haven't updated your hgrc in years. Used to be that adding the hook to your [.]hgrc was all that was required. Now you have to enable notify as well, so, e.g.
[extensions]
notify=
[hooks]
changegroup.notify = python:hgext.notify.hook
You also need some things to allow the email notication to work, for example if you have personal email support on the same server:
[reposubs]
* = [my email on the server]
[email]
from = Mercurial Notification <noreply@mydomain>
[smtp]
host = localhost