Files
Agent-System/scripts/generate-commit-rewrite-map.py
weichenandCursor 9e8ff2ff4a chore(scripts): add epic history rewrite tooling and SHA map docs
Replay 358 linear commits as 14 feature/fix epics with merge --no-ff;
include manifest, rewrite script, SHA map, and git-workflow-helper alignment.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:51:33 +00:00

36 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Print old->new commit SHA map by matching subject|author|email|date."""
from __future__ import annotations
import subprocess
import sys
ROOT = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip()
def git(*args: str) -> str:
return subprocess.check_output(["git", "-C", ROOT, *args], text=True).strip()
def signature(commit: str) -> str:
return git("log", "-1", "--format=%s|%an|%ae|%ad", commit, "--date=iso-strict")
def main() -> int:
old_hashes = git("log", "dev-old-linear", "--format=%H").splitlines()
new_by_sig: dict[str, str] = {}
for h in git("log", "dev", "--format=%H").splitlines():
new_by_sig[signature(h)] = h
print("old_sha\tnew_sha\tsubject")
for old in reversed(old_hashes):
sig = signature(old)
new = new_by_sig.get(sig, "")
subj = git("log", "-1", "--format=%s", old)
print(f"{old[:12]}\t{new[:12] if new else 'NOT_FOUND'}\t{subj}")
return 0
if __name__ == "__main__":
sys.exit(main())