For instance http://stackoverflow.com/questions/14211261/how-to-force-rhodecode-to-invalidate-cache-after-push-via-ssh hints that something like
[hooks] incoming.rhodecode = python:rhodecode.lib.hooks.log_push_action
It will however fail with:
calling hook incoming.rhodecode: rhodecode.lib.hooks.log_push_action error: incoming.rhodecode hook raised an exception: Missing data in repo.ui and os.environ Traceback (most recent call last): File ".../rhodecode-venv/lib/python2.7/site-packages/mercurial-2.5.2-py2.7-linux-x86_64.egg/mercurial/hook.py", line 79, in _pythonhook r = obj(ui=ui, repo=repo, hooktype=name, **args) File ".../rhodecode/rhodecode/lib/hooks.py", line 242, in log_push_action raise Exception('Missing data in repo.ui and os.environ')
If it is supposed to work then it seems like some documentation and code changes are necessary.
If some other method is recommended then it should be mentioned somewhere.