Get high-churn files from last 90 days.
()
| 337 | |
| 338 | |
| 339 | def get_git_churn() -> List[str]: |
| 340 | """Get high-churn files from last 90 days.""" |
| 341 | try: |
| 342 | result = subprocess.run( |
| 343 | ["git", "log", "--since=90 days ago", "--name-only", "--pretty=format:"], |
| 344 | capture_output=True, |
| 345 | text=True, |
| 346 | cwd=Path.cwd() |
| 347 | ) |
| 348 | if result.returncode == 0: |
| 349 | files = [f.strip() for f in result.stdout.split('\n') if f.strip()] |
| 350 | # Count occurrences |
| 351 | from collections import Counter |
| 352 | counts = Counter(files) |
| 353 | churn = sorted(counts.items(), key=lambda x: x[1], reverse=True) |
| 354 | return [f"{count:4d} {filename}" for filename, count in churn[:CHURN_LIMIT]] |
| 355 | return [] |
| 356 | except Exception: |
| 357 | return [] |
| 358 | |
| 359 | |
| 360 | def is_git_repo() -> bool: |