title: How to display current working copy version of an hg repository on a PHP page
body: <p>I use Mercurial for most of my projects and when I deploy a web site, I simply just do an <code>hg clone</code> on the production server and <code>hg pull -u</code> from there. What I'd like to do is add a small snippet to my site's footer which displays the current revision number (both decimal and hex) as well as perhaps the current branch. Stack Overflow and BitBucket both do a variation of what I'm looking for.</p>
  
  <p>I briefly tried parsing the output of <code>exec('hg summary')</code>, but I ran into a couple permissions problems before wondering if there was any better way to do it. Is there a better way, or is <code>exec</code> my best option?</p>