diff --git a/misc/sync-typeshed.py b/misc/sync-typeshed.py index a8aca425696a..cbaa7029620f 100644 --- a/misc/sync-typeshed.py +++ b/misc/sync-typeshed.py @@ -185,7 +185,21 @@ def main() -> None: "9f3bbbeb1", # ParamSpec for functools.wraps ] for commit in commits_to_cherry_pick: - subprocess.run(["git", "cherry-pick", commit], check=True) + try: + subprocess.run(["git", "cherry-pick", commit], check=True) + except subprocess.CalledProcessError: + if not sys.__stdin__.isatty(): + # We're in an automated context + raise + + # Allow the option to merge manually + print( + f"Commit {commit} failed to cherry pick." + " In a separate shell, please manually merge and continue cherry pick." + ) + rsp = input("Did you finish the cherry pick? [y/N]: ") + if rsp.lower() not in {"y", "yes"}: + raise print(f"Cherry-picked {commit}.") if args.make_pr: