Park on a new review once requested changes are answered, never park a Gitea draft, and count a slot only for a window that started

This commit is contained in:
2026-11-18 23:53:28 +01:00
parent 0eea8aa10d
commit 89a7cfe65a
14 changed files with 219 additions and 71 deletions
+10 -7
View File
@@ -49,8 +49,12 @@ class Listed:
id: str
# Whether its loop has exited: `remain-on-exit failed` keeps the window of a loop that failed, so its last lines stay readable.
dead: bool
# Whether its chunk is parked: its name held PARKED.
parked: bool = False
# What its name says its parked chunk awaits, as the words after PARKED; empty for a chunk that isn't parked.
awaits: str = ""
@property
def parked(self) -> bool:
return bool(self.awaits)
@dataclasses.dataclass(frozen=True)
@@ -85,8 +89,8 @@ def listed(session: str, run: Tmux) -> list[Listed]:
def as_listed(shown: str, id: str, pane_dead: str) -> Listed:
"""The window tmux shows under the name shown, with the ID id and `#{pane_dead}` as pane_dead."""
name, parked, _ = shown.removesuffix(WAITS).partition(PARKED)
return Listed(name, id, pane_dead == "1", bool(parked))
name, _, awaits = shown.removesuffix(WAITS).partition(PARKED)
return Listed(name, id, pane_dead == "1", awaits)
def everywhere(run: Tmux) -> list[Placed]:
@@ -142,13 +146,12 @@ def mark(window: Window, waits: bool, run: Tmux) -> None:
def park(window: Window, on: str, run: Tmux) -> None:
"""Shows window's chunk as parked while its pull request awaits on, such as `an approval`: the name says so, and the window names no folder its chunk works in, so no checkout counts it as a running chunk."""
"""Shows window's chunk as parked while its pull request awaits on, such as `an approval`: the name says so, and no checkout counts a window so named as a running chunk."""
run(["rename-window", "-t", window.pane, window.name + PARKED + on])
run(["set-option", "-w", "-u", "-t", window.pane, ROOT])
def unpark(window: Window, root: str, run: Tmux) -> None:
"""Shows window's chunk as running again, in the folder root."""
"""Shows window's chunk as running again, in the folder root. The window may name another folder: one started again for a parked chunk starts in the epic's folder."""
run(["rename-window", "-t", window.pane, window.name])
run(["set-option", "-w", "-t", window.pane, ROOT, root])