34 lines
1.1 KiB
Python
Executable File
34 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Action ``commits`` (read-only): a conversation's commits, oldest first.
|
|
|
|
stdin ``{conversationId, uncommitted?: bool}`` → ``{id, commits: [commit record…],
|
|
additions, deletions, filesChanged, exact, worker, repos, via: "commits"|"core",
|
|
uncommitted: {files (no hunks), additions, deletions, worktrees, subtitle,
|
|
source} | null}`` (``uncommitted`` only when asked — the Changes tab's one read).
|
|
The list comes from the ``commits`` plugin's ``list`` export when it is active,
|
|
else from the core's ``hub/diff/conversations/{cid}/commits``."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pathlib
|
|
import sys
|
|
|
|
sys.dont_write_bytecode = True
|
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
|
import _lib # noqa: E402
|
|
|
|
|
|
def main(p: dict) -> dict:
|
|
cid = _lib.conversation_id(p)
|
|
out = _lib.conversation_commits(cid)
|
|
if p.get("uncommitted"):
|
|
try:
|
|
out["uncommitted"] = _lib.strip_hunks(_lib.uncommitted(cid, stats=True))
|
|
except _lib.Fail:
|
|
out["uncommitted"] = None
|
|
return out
|
|
|
|
|
|
if __name__ == "__main__":
|
|
_lib.run(main)
|