mercurial now switches branches (with check for uncomitted changes so it's safe). Added tests for mercurial.

mercurial now switches branches (with check for uncomitted changes so it's safe). Added tests for mercurial.