def run_mercurial_command(hg_command):
    hg_executable = os.environ.get("HG", "hg")
    hg_command_tuple = hg_command.split()
    hg_command_tuple.insert(0, hg_executable)
    # If you install your own mercurial version in your home
    # hg_executable does not always have execution permission.
    if not os.access(hg_executable, os.X_OK):
        hg_command_tuple.insert(0, sys.executable)
    try:
        hg_subprocess = Popen(hg_command_tuple, stdout=PIPE, stderr=PIPE)
    except __HOLE__ as e:
        print("Can't find the hg executable!", file=sys.stderr)
        print(e)
        sys.exit(1)

    hg_out, hg_err = hg_subprocess.communicate()
    if len(hg_err) > 0:
        raise MercurialRuntimeError(hg_err)
    return hg_out
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/misc/hooks/check_whitespace.py/run_mercurial_command