feat/dossiers-ngi: sticky bar vs-main compact dates tabular wider tree
This commit is contained in:
parent
3feb694084
commit
8cb55e57e8
6 changed files with 231 additions and 192 deletions
|
|
@ -235,11 +235,11 @@ def tip_recorded(editions: Path, slug: str) -> str:
|
|||
|
||||
|
||||
|
||||
def diff_numstat(repo: Path, parent_tip: str, tip: str) -> tuple[int, int]:
|
||||
"""Insertions/deletions of tip vs parent tip (git diff --numstat)."""
|
||||
if not parent_tip or not tip or parent_tip == tip:
|
||||
def diff_numstat(repo: Path, a: str, b: str) -> tuple[int, int]:
|
||||
"""Insertions/deletions of b vs a (git diff --numstat)."""
|
||||
if not a or not b or a == b:
|
||||
return 0, 0
|
||||
cp = git(repo, "diff", "--numstat", parent_tip, tip, check=False)
|
||||
cp = git(repo, "diff", "--numstat", a, b, check=False)
|
||||
if cp.returncode != 0:
|
||||
return 0, 0
|
||||
plus = minus = 0
|
||||
|
|
@ -564,6 +564,10 @@ def build_payload(repo: Path, tips: dict[str, str], rebuild: bool) -> dict:
|
|||
sync_flask_alias(ed_root, tips)
|
||||
|
||||
tip_times = {name: tip_commit_time(repo, tip) for name, tip in tips.items()}
|
||||
main_tip = tips.get("main", "")
|
||||
vs_main = {
|
||||
name: diff_numstat(repo, main_tip, tip) for name, tip in tips.items()
|
||||
}
|
||||
branches_out = []
|
||||
for row in rows:
|
||||
name = row["branch"]
|
||||
|
|
@ -589,12 +593,11 @@ def build_payload(repo: Path, tips: dict[str, str], rebuild: bool) -> dict:
|
|||
entry["built_at"] = meta["built_at"]
|
||||
if "build_seconds" in meta:
|
||||
entry["build_seconds"] = meta["build_seconds"]
|
||||
# sticky bar: +grün / −rot vs parent tip; omit when no parent
|
||||
parent = row["parent"]
|
||||
if parent and parent in tips:
|
||||
plus, minus = diff_numstat(repo, tips[parent], row["tip"])
|
||||
entry["vs_parent_plus"] = plus
|
||||
entry["vs_parent_minus"] = minus
|
||||
# sticky bar: +grün / −rot vs main (omit on main itself)
|
||||
if name != "main" and main_tip:
|
||||
plus, minus = vs_main.get(name, (0, 0))
|
||||
entry["vs_main_plus"] = plus
|
||||
entry["vs_main_minus"] = minus
|
||||
branches_out.append(entry)
|
||||
|
||||
payload = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue