livery.workshop._forge_lane¶
livery.workshop._forge_lane ¶
Resolve this workspace's repository on its forge.
The workspace contract's [forge] table names the kind and owner;
the repository name comes from the origin remote. Tokens resolve
through livery.workshop._tokens: FORGE_TOKEN (host-qualified
first), and each backend's own documented fallback when neither is
set. Nothing here is inferred from ambient state beyond those
documented lookups.
Functions:
| Name | Description |
|---|---|
shown_url |
url as a message may show it: any user and password replaced by |
forge_repository |
This workspace's repository name on its forge: the name |
this_forge |
The workspace's forge, per the contract's |
admin_forge |
The forge for an admin verb, and the variable that armed it. |
admin_repository |
The repository bound to the admin ladder's forge. |
this_repository |
The workspace's repository, per the contract and the remote. |
forge_kind |
The forge the workspace's contract names, |
pull_request_for |
The pull request branch is or was the head of, or None. |
shown_url ¶
url as a message may show it: any user and password replaced by ***.
A remote's URL can carry a token (http://oauth2:<token>@host/...),
and a refusal that names the URL is printed, logged and recorded. An
ssh spelling (git@host:owner/name) names a user and no secret,
and is shown as it is.
Source code in packages/workshop/src/livery/workshop/_forge_lane.py
forge_repository ¶
This workspace's repository name on its forge: the name origin points at.
The remote's URL in either spelling, https://host/owner/name or
git@host:owner/name, with or without .git.
Raises:
| Type | Description |
|---|---|
Failed
|
when root has no |
Source code in packages/workshop/src/livery/workshop/_forge_lane.py
this_forge ¶
The workspace's forge, per the contract's [forge] table.
The token is FORGE_TOKEN (host-qualified first); with neither
set, the backend's own documented fallback decides.
Returns:
| Type | Description |
|---|---|
Forge
|
The connected livery.forge.Forge. |
Source code in packages/workshop/src/livery/workshop/_forge_lane.py
admin_forge ¶
The forge for an admin verb, and the variable that armed it.
Least privilege by split tokens: the everyday verbs never read
the admin name, and the admin verbs (configure, the post-abort
reconcile) resolve FORGE_ADMIN_TOKEN (host-qualified first)
with a fallback to the everyday token; the fallback keeps a solo
developer whose one token already administers working with
nothing extra. The second value names the admin variable used,
"" for the fallback, so a refusal can teach the missing grant.
Source code in packages/workshop/src/livery/workshop/_forge_lane.py
admin_repository ¶
admin_repository(root: Path) -> tuple[Repository, str]
The repository bound to the admin ladder's forge.
Source code in packages/workshop/src/livery/workshop/_forge_lane.py
this_repository ¶
this_repository(root: Path) -> Repository
The workspace's repository, per the contract and the remote.
Source code in packages/workshop/src/livery/workshop/_forge_lane.py
forge_kind ¶
The forge the workspace's contract names, github, gitea or gitlab.
Empty when the contract names none, which the fake forge speaks for, and when there is no contract to read.
Source code in packages/workshop/src/livery/workshop/_forge_lane.py
pull_request_for ¶
pull_request_for(repo: Repository, root: Path, branch: str) -> PullRequest | None
The pull request branch is or was the head of, or None.
By head branch first, then by the branch's head commit: a forge that deletes the head branch on merge may clear the merged pull request's head ref, and the commit persists after the branch is gone. A pull request found by the commit is the branch's own only when its head branch is branch or empty, and never while branch is a stacked branch still at the commit it started from: that commit is the parent's head, so the pull request found is the parent's. A forge that cannot be asked raises; the caller decides what an unanswered question means, never this function.