title: Committing data to Mercurial at the end of a build
body: <p>I have a build script that is triggered by Jenkins.
  First Jenkins will get the latest version from the repo (Bitbucket) and then it will initiate the build script.
  Now if the build script is started in 'release' mode the script will make changes to some files (to keep track of version numbers and build dates, and to create a tag on the repo)
  These changes need to be pushed back up to the remote repo.</p>
  
  <p>How do I implement this?
  The build takes a couple of minutes, so if someone pushes to the remote repo during the build then the push will fail because a merge is needed first. If that was not the case the merge will fail because there was nothing to merge...</p>