Determines the type of repo that `repo_url` represents.
    :param repo_url: Repo URL of unknown type.
    :returns: VCS type (git, hg, etc) or raises UnknownVCS exception.

def identify_vcs(repo_url, guess=False, repo_aliases=REPO_ALIASES):
    """
    Determines the type of repo that `repo_url` represents.
    :param repo_url: Repo URL of unknown type.
    :returns: VCS type (git, hg, etc) or raises UnknownVCS exception.
    """
    repo_url = unicode(repo_url)

    # Do basic alias check
    vcs = identify_vcs_vs_alias(repo_url, guess=guess, repo_aliases=repo_aliases)
    if vcs:
        return vcs

    # remove prefix and try again
    no_prefix = ''.join(repo_url.split("//")[1:])
    vcs = identify_vcs_vs_alias(no_prefix, guess=guess, repo_aliases=repo_aliases)
    if vcs:
        return vcs

    if guess:
        if "bitbucket" in repo_url:
            return "hg"

    raise UnknownVCS