I have the same problem as a guy asking this question: How to git commit nothing without an error? Basically I need to run hg commit, only if there are any changes in my repository. I am using fabric to run the commit, so if there are no changes, it will output a nasty error.
local() encountered an error (return code 1) while executing 'hg commit...'
This is the answer from aforementioned thread:
git add -A
git diff --quiet --exit-code --cached || git commit -m 'bla'
It works for git, however I use Merucrial. I have no idea how to do it in Mercurial.