Repository: apple/swift
File: utils/update_checkout/update_checkout/update_checkout.py (Python)

Code before:

    # Then make sure the alias names used by our branches are unique.
    seen: Dict[str, Any] = dict()
    for scheme_name, scheme in config["branch-schemes"].items():
        aliases = scheme["aliases"]
        for alias in aliases:
            if alias in seen:
                raise RuntimeError(
                    "Configuration file defines the alias {0} "
                    "in both the {1} scheme and the {2} scheme?!".format(
                        alias, seen[alias], scheme_name
                    )
                )
            else:
                seen[alias] = scheme_name


def full_target_name(repo_path: Path, repository: str, target: str) -> str:
    branch, _, _ = Git.run(repo_path, ["branch", "--list", target], fatal=True)
    branch = branch.replace("* ", "")
    if branch == target:
        name = "%s/%s" % (repository, target)
        return name

    # This is either a tag or commit hash -- we can use it as is
    return target


def skip_list_for_platform(config: Dict[str, Any], all_repos: bool) -> List[str]:
    """Computes a list of repositories to skip when updating or cloning, if not
    overridden by `--all-repositories` CLI argument.

    Args:
        config (Dict[str, Any]): deserialized `update-checkout-config.json`
        all_repos (bool): include all repositories.

    Returns:
        List[str]: a resulting list of repositories to skip or empty list if
        `all_repos` is not empty.
    """

    if all_repos:
        return []  # Do not skip any platform-specific repositories

    # If there is a platforms key only include the repo if the
    # platform is in the list
    skip_list = []
    platform_name = platform.system()

    for repo_name, repo_info in config["repos"].items():
        if "platforms" in repo_info:

Review comment (suggestion):
```suggestion
def full_target_name(repo_path: Path, remote: str, target: str) -> str:
    branch, _, _ = Git.run(repo_path, ["branch", "--list", target], fatal=True)
    branch = branch.replace("* ", "")
    if branch == target:
        name = "%s/%s" % (remote, target)
        return name

    # This is either a tag or commit hash -- we can use it as is
    return target
```

Code after:

    # Then make sure the alias names used by our branches are unique.
    seen: Dict[str, Any] = dict()
    for scheme_name, scheme in config["branch-schemes"].items():
        aliases = scheme["aliases"]
        for alias in aliases:
            if alias in seen:
                raise RuntimeError(
                    "Configuration file defines the alias {0} "
                    "in both the {1} scheme and the {2} scheme?!".format(
                        alias, seen[alias], scheme_name
                    )
                )
            else:
                seen[alias] = scheme_name


def full_target_name(repo_path: Path, remote: str, target: str) -> str:
    branch, _, _ = Git.run(repo_path, ["branch", "--list", target], fatal=True)
    branch = branch.replace("* ", "")
    if branch == target:
        name = "%s/%s" % (remote, target)
        return name

    # This is either a tag or commit hash -- we can use it as is
    return target


def skip_list_for_platform(config: Dict[str, Any], all_repos: bool) -> List[str]:
    """Computes a list of repositories to skip when updating or cloning, if not
    overridden by `--all-repositories` CLI argument.

    Args:
        config (Dict[str, Any]): deserialized `update-checkout-config.json`
        all_repos (bool): include all repositories.

    Returns:
        List[str]: a resulting list of repositories to skip or empty list if
        `all_repos` is not empty.
    """

    if all_repos:
        return []  # Do not skip any platform-specific repositories

    # If there is a platforms key only include the repo if the
    # platform is in the list
    skip_list = []
    platform_name = platform.system()

    for repo_name, repo_info in config["repos"].items():
        if "platforms" in repo_info: