Show the current Git, Mercurial, Subversion or Bazaar branch in your prompt

This bash script prefixes the prompt with the branch name whenever the working directory is in a Git, Mercurial, Subversion or Bazaar branch. The code is part of my bash-environ package. Here it is on Ubuntu Pastebin, and a plaint-text download.