I've been trying
def debug_hook(ui, repo, **kwargs):
changectx = repo[None]
ui.status('change.desc: %s\n' % changectx.description())
return True
But it always prints an empty string. Is this because it is a precommit hook and the message isn't available yet? Or am I just missing something obvious?