make-patch.py 699 B

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