Moved hg branch to it's own function for readability