commit-backend.py 1.4 KB

123456789101112131415161718192021
  1. from pathlib import Path
  2. import json
  3. import subprocess
  4. root = Path(__file__).resolve().parent
  5. target = Path('E:/pipe-ner-server').resolve()
  6. manifest = json.loads((root/'manifest.json').read_text(encoding='utf-8'))
  7. paths = [row['path'] for row in manifest]
  8. for rel in paths:
  9. actual = (target/rel).read_bytes().replace(b'\r\n',b'\n')
  10. expected = (root/rel).read_bytes().replace(b'\r\n',b'\n')
  11. if actual != expected:
  12. raise SystemExit('Concurrent changes: do not stage or commit ' + rel)
  13. subprocess.run(['git','diff','--check'],cwd=target,check=True)
  14. subprocess.run(['git','diff','--cached','--quiet'],cwd=target,check=True)
  15. subprocess.run(['git','add','--']+paths,cwd=target,check=True)
  16. # Only this ticket's 18 selected files; shared distribution prerequisite is included and documented.
  17. subprocess.run(['git','diff','--cached','--stat'],cwd=target,check=True)
  18. subprocess.run(['git','commit','-m','fix(cockpit): align map and monitoring pointStatus eight-bucket contract',
  19. '-m','Support CSV/repeated status filters, stable global counts and explicit device status publication. Preserve empty-point distribution prerequisites. Add cross-endpoint, cancelled-order and Redis compatibility coverage. Verified 75 focused tests, 429 cockpit tests, 45 real GET assertions and browser filtering 13 -> 1 -> 2.'],cwd=target,check=True)
  20. subprocess.run(['git','log','-1','--format=%H %s'],cwd=target,check=True)