livery.workshop._sweep¶
livery.workshop._sweep ¶
What the workshop leaves in the runner's directories, and the sweep that bounds it.
The runner's data directory holds the workshop's durable state: the
issue worktrees under worktrees/<repo>/ and the loop's workspace.
footman's collector never touches it, by design. This module is the
workshop's sweeper, registered under footman's footman.sweepers
entry point and run by fm janitor, by the daily collector child,
and, for the worktrees alone, by every fm start.
It also runs the state store's own janitor over every series the
workshop keeps (livery.workshop._series), in the scope the run
has: the checkout's local series on a machine, the remote series too
inside CI.
The rules, each saying what went or why it stayed:
- A worktree whose linked git directory is gone (its checkout was deleted) goes. This rule is quick and offline: no forge is asked.
- A worktree whose issue is closed, or whose branch's pull request
merged, goes when the branch holds nothing that exists nowhere else,
decided by the one keep-or-drop rule
fm issue.closeuses (livery.workshop._submit.only_local_work): a tree whose tip the merge took holds nothing only there, whatever a squash did to the ancestry. A tree with uncommitted changes or commits past the merge stays and is named, and so is a tree whose issue is open or whose forge cannot be asked. A closed issue's tree also stays while its branch heads an open pull request, asfm issue.closeleaves it, since that pull request still needs the branch. A tree whose name carries no issue number is judged by its branch's pull request alone. This rule asks the forge, since asking is what proves the removal safe. - A local branch of the checkout whose pull request merged and took
its tip goes by the same rule; the branch a linked worktree holds
belongs to the worktree rule, and the branch the checkout stands on
is named for
fm syncto step off. On demand only, like the rule above. - Every declared series of the state store is bounded, windows, ages, and orphans, as livery.git.sweep says.
- The config directory is reported, never touched: anything beside the user's config, tasks file, and shared env file is named. The loop's workspace is reported by size and kept.
Functions:
| Name | Description |
|---|---|
sweep |
The workshop's sweep, footman's sweeper contract; the lines to print. |
sweep_worktrees |
Sweep every |
sweep_branches |
Drop the checkout's local branches whose pull request merged and took their tip. |
sweep_branch |
Drop branch when its pull request merged and took its tip; whether it went. |
sweep_store |
Bound every declared series of the state store in the run's scope; the lines. |
report_config |
Name what sits in the config directory beside the user's own files. |
report_loop |
The loop's workspace by size, kept: |
Attributes:
| Name | Type | Description |
|---|---|---|
WORKTREES |
|
|
LOOP |
|
|
CONFIG_OWN |
|
sweep ¶
The workshop's sweep, footman's sweeper contract; the lines to print.
The state store's series are the checkout's: the one above the
working directory, or the root among facts when one is
given, None for no checkout at all.
Source code in packages/workshop/src/livery/workshop/_sweep.py
sweep_worktrees ¶
Sweep every <repo>/<number>-<slug> worktree under home; the lines.
Source code in packages/workshop/src/livery/workshop/_sweep.py
sweep_branches ¶
Drop the checkout's local branches whose pull request merged and took their tip.
A branch a linked worktree holds is the worktree rule's; the base branch is never touched; the branch the checkout stands on is named, since a sweep never moves a person's HEAD. Asks the forge, since asking is what proves the removal safe. The lines say what went and why the rest stayed.
Source code in packages/workshop/src/livery/workshop/_sweep.py
sweep_branch ¶
sweep_branch(root: Path, branch: str, *, current: str, dry_run: bool, repo: Any = None) -> tuple[bool, str]
Drop branch when its pull request merged and took its tip; whether it went.
The rule sweep_branches applies to each of the checkout's
branches, for one. fm start asks it before it re-enters a
branch that has no worktree, since a merged branch is finished work
and a start begins fresh. The branch the checkout stands on
(current) stays, named for fm sync to step off, and so does
one whose forge cannot be asked. repo is the forge's repository,
asked for when absent. The line says what went, or why it stayed.
Source code in packages/workshop/src/livery/workshop/_sweep.py
sweep_store ¶
Bound every declared series of the state store in the run's scope; the lines.
Source code in packages/workshop/src/livery/workshop/_sweep.py
report_config ¶
Name what sits in the config directory beside the user's own files.
Source code in packages/workshop/src/livery/workshop/_sweep.py
report_loop ¶
The loop's workspace by size, kept: fm ci.e2e reuses it.