| 35 | |
| 36 | |
| 37 | def rebase(oldtag: str, newtag: str) -> None: |
| 38 | run(["git", "checkout", oldtag, "--quiet"], cwd=EMSCRIPTEN) |
| 39 | run(["git", "switch", "-C", f"pyodide-{newtag}"], cwd=EMSCRIPTEN) |
| 40 | patches = sorted(PATCHES.glob("*")) |
| 41 | result = run(["git", "am", *patches], cwd=EMSCRIPTEN, check=False) |
| 42 | if result.returncode: |
| 43 | run(["git", "am", "--quit"], cwd=EMSCRIPTEN, check=False) |
| 44 | sys.exit(result.returncode) |
| 45 | result = run( |
| 46 | ["git", "rebase", oldtag, "--onto", newtag], cwd=EMSCRIPTEN, check=False |
| 47 | ) |
| 48 | while True: |
| 49 | if result.returncode == 0: |
| 50 | return |
| 51 | result = run( |
| 52 | ["git", "diff", "--quiet"], |
| 53 | check=False, |
| 54 | cwd=EMSCRIPTEN, |
| 55 | ) |
| 56 | if result.returncode != 0: |
| 57 | print( |
| 58 | "There were rebase conflicts. Resolve the conflicts and then run again." |
| 59 | ) |
| 60 | sys.exit(1) |
| 61 | result = run(["git", "rebase", "--continue"], check=False, cwd=EMSCRIPTEN) |
| 62 | |
| 63 | |
| 64 | def update_patches(newtag: str) -> None: |