def METHOD_NAME(cls, location: str) -> Optional[str]:
    loc = super().METHOD_NAME(location)
    if loc:
        return loc
    try:
        r = cls.run_command(
            ["root"],
            cwd=location,
            show_stdout=False,
            stdout_only=True,
            on_returncode="raise",
            log_failed_cmd=False,
        )
    except BadCommand:
        logger.debug(
            "could not determine if %s is under hg control "
            "because hg is not available",
            location,
        )
        return None
    except InstallationError:
        return None
    return os.path.normpath(r.rstrip("\r\n"))