title: How do I tag a specific revision in Mercurial when promoting a build in Jenkins?
body: <p>I have a Jenkins CI server with the Promoted Builds plug-in and the Mercurial plug-in.  What I would like to do when a build gets promoted is tag the revision in Mercurial that corresponds to that build.  </p>
  
  <p>The Mercurial plug-in exposes an environment variable called MERCURIAL_REVISION_NUMBER, and this is populated when the build runs, but not when the promotion runs.  So when I try do the following in an "Execute a Windows batch command" step in my promotion:</p>
  
  <p><code>hg tag --rev %MERCURIAL_REVISION_NUMBER% "Promoted-%PROMOTED_NUMBER%-%PROMOTED_ID%"</code></p>
  
  <p>it fails because %MERCURIAL_REVISION_NUMBER% evaluates to an empty string, so there is no value supplied to the --rev argument.</p>
  
  <p>I do notice that the Mercurial revision is saved in the build.xml file for each build.  I'm wondering if there is an easy way to get to it in my promotion step.</p>