Scope git history to current diagram by default
- History panel defaults to "This diagram" / "All" toggle - "This diagram" filters git log to commits that touched only that diagram's JSON file (git log -- diagrams/0001_*.json) - Automatically switches to "All" when no diagram is open - Restore flow still works per-commit, per-file Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -185,9 +185,13 @@ def git_status():
|
||||
|
||||
|
||||
@router.get("/log")
|
||||
def git_log():
|
||||
def git_log(diagram_id: Optional[int] = None):
|
||||
repo_root = _repo_root()
|
||||
r = _run("log", "--pretty=format:%H|%h|%s|%an|%ai", "-30", cwd=repo_root)
|
||||
cmd = ["log", "--pretty=format:%H|%h|%s|%an|%ai", "--follow", "-50"]
|
||||
if diagram_id is not None:
|
||||
# Filter to commits that touched this diagram's file (glob by id prefix)
|
||||
cmd += ["--", f"diagrams/{diagram_id:04d}_*.json"]
|
||||
r = _run(*cmd, cwd=repo_root)
|
||||
if r.returncode != 0:
|
||||
return []
|
||||
entries = []
|
||||
|
||||
Reference in New Issue
Block a user