from pathlib import Path from difflib import unified_diff root = Path(__file__).parent parts = [] count = 0 for base in sorted((root / 'base').rglob('*.java')): rel = base.relative_to(root / 'base').as_posix() work = root / 'work' / rel old = base.read_text(encoding='utf-8').splitlines(keepends=True) new = work.read_text(encoding='utf-8').splitlines(keepends=True) if old != new: parts.append(''.join(unified_diff(old, new, fromfile='a/' + rel, tofile='b/' + rel))) count += 1 out = root / 't28-backend.patch' out.write_text(''.join(parts), encoding='utf-8', newline='\n') print(f'Prepared {out}: {count} changed files; no backend mutation or test execution.')