def METHOD_NAME(base_branch: str, all_packages=False):
    """
    Get the changed dependencies.
    all_packages: bool
        If True, return all packages, not just the direct dependencies.
    """
    src_dir = Path(__file__).parent.parent
    branches = get_branches()
    if base_branch not in branches:
        if f"origin/{base_branch}" not in branches:
            raise ValueError(
                f"base branch {base_branch} not found in {branches!r}"
            )
        base_branch = f"origin/{base_branch}"
    changed_packages = calc_changed_packages(base_branch, src_dir)
    if all_packages:
        return sorted(set(changed_packages))
    return calc_only_direct_updates(changed_packages, src_dir)