Add better support of Mercurial

This is a modest first contribution. Please let me know if you haev something to say about that piece of modification for Mercurial.