def _get_hg_version():
    try:
        value, output, _ = run_shell_command('hg --version',
                                             shell=True,
                                             us_env=True)
        if value == 0 and output is not None and len(output.splitlines()) > 0:
            version = output.splitlines()[0]
        else:
            raise VcsError("hg --version returned %s, output '%s', maybe hg is not installed" % (value, output))
    except VcsError as e:
        raise VcsError("Could not determine whether hg is installed %s" % e)
    return version


# hg diff cannot seem to be persuaded to accept a different prefix for filenames
Looks up hg version by calling hg --version.
dataset/ETHPy150Open vcstools/vcstools/src/vcstools/hg.py/_get_hg_version