$ \textbf{cat .hg/hgrc}
[hooks]
pretxncommit.whitespace = hg export tip | (! grep -qP '^\textbackslash{}+.*[ \textbackslash{}t]$')
$ \textbf{echo 'a ' > a}
$ \textbf{hg commit -A -m 'test with trailing whitespace'}
adding a
abort: pretxncommit.whitespace hook exited with status 1
transaction abort!
rollback completed
$ \textbf{echo 'a' > a}
$ \textbf{hg commit -A -m 'drop trailing whitespace and try again'}