sow repo
A standard repository is one directory tree in the
workspace with its own package pool (pool/), indexes (dists/), database, and build history.
Its Dists share the pool, so a package used by several Dists is stored once. sow repo creates,
lists, inspects, upgrades, and removes these repositories. Put packages in separate repositories
when they need separate signing, deletion protection, or publication targets; otherwise add Dists
to one repository with sow dist.
Synopsis
repo new, repo migrate, and repo rm accept --passfile for
signing checks, signing, or recovery of an interrupted operation. repo ls and repo show do not
read password files.
Examples
Create the repositories for a two-tier layout:
Create a repository without waiting for a held lock:
Print each repository’s name, state, and Generation:
Naming
A repository name must match [a-z0-9][a-z0-9._-]*. It may not be ., .., .sow, pool, or
dists, or collide with a reserved workspace file. SOW creates the repository at
<workspace>/<NAME>/.
sow repo ls
Lists every repository in the workspace. Read-only.
| Flag | Description | Default |
|---|---|---|
-C, --workdir DIR |
Workspace discovery start directory | current directory |
--json |
Output JSON | false |
STATUS is clean, dirty, recovering, or error.
Transactions & Recovery explains what each means for clients.
sow repo new
Adds the repository to sow.yml, then creates <workspace>/<NAME>/{pool,dists}, its SQLite
database, and its private state. A new repository starts at Generation 0, clean.
| Flag | Description | Default |
|---|---|---|
-C, --workdir DIR |
Workspace discovery start directory | current directory |
-T, --timeout DUR |
Maximum lock wait; 0 waits indefinitely |
0 |
-N, --no-wait |
Fail immediately when the lock is held | false |
--passfile PATH |
Password file for this invocation | per-key config, then SOW_GPG_PASSFILE |
--json |
Output JSON | false |
Running it again for an existing repository prints the current state and creates nothing.
sow repo show
Shows one repository in detail. Read-only. Without NAME, the usual
repository selection applies.
| Flag | Description | Default |
|---|---|---|
-C, --workdir DIR |
Workspace discovery start directory | current directory |
-r, --repo NAME |
Select the repository when NAME is omitted |
selection rules |
--json |
Output JSON | false |
If you pass both NAME and -r, they must name the same repository:
sow repo rm
Removes a repository completely: its sow.yml entry, database, package files in pool/, indexes
in dists/, and private state. Without -f, only an empty repository can be removed, one with no
Dists, no memberships, and no package objects:
| Flag | Description | Default |
|---|---|---|
-f, --force |
Remove a non-empty unprotected repository | false |
-C, --workdir DIR |
Workspace discovery start directory | current directory |
-T, --timeout DUR |
Maximum lock wait; 0 waits indefinitely |
0 |
-N, --no-wait |
Fail immediately when the lock is held | false |
--passfile PATH |
Password file for this invocation | per-key config, then SOW_GPG_PASSFILE |
--json |
Output JSON | false |
Force removal
-f lifts only the emptiness check. It does not override protected.
protected
protected: true in sow.yml blocks repository deletion outright, -f included:
To remove a protected repository, set protected: false in sow.yml, run
sow config check, and retry. Protection covers repository deletion only;
add, rm, build, and dist rm keep working:
sow repo migrate
repo migrate brings a repository’s database and layout up to the current schema (v13) and
resumes or abandons an unfinished layout transition. Only workspaces from early releases need it;
the upgrade guide says which. In 0.9.0, sow status can inspect schema v12 and returns 5 for v8 or v10. sow build exits 6 and requests migration on all three. See Troubleshooting after an upgrade.
- Stop all workspace writers.
- Back up the whole workspace, preserving hard links.
- Migrate each configured repository.
- Run
buildandcheckfor each repository.
Repeat the last three commands for each repository. The result reports the layout and schema
before and after (schema_from and schema_to in JSON); on a repository that is already current
it is a no-op:
Migration also applies the state and publication repairs that older layouts need. After a C2
layout migration, SOW binds the migration anchor to the newly migrated Generation, so later
build, add, check, gc, and repo rm commands do not report an anchor mismatch. To return
to a release that uses an older schema, restore the backup.
If a completed migration leaves stage files whose ownership SOW cannot prove, it keeps them under
.sow/<repo>/abandoned/ and reports the path. Rerun sow repo migrate NAME to clear that state
and unblock local GC, and inspect the retained files before you delete them.
| Flag | Description | Default |
|---|---|---|
-j, --jobs N |
Parallel verification/render workers | logical CPUs |
--abort |
Abandon a maintenance attempt before its commit decision | false |
-C, --workdir DIR |
Workspace discovery start directory | current directory |
-r, --repo NAME |
Select the repository when NAME is omitted |
selection rules |
-T, --timeout DUR |
Maximum lock wait; 0 waits indefinitely |
0 |
-N, --no-wait |
Fail immediately when the lock is held | false |
--passfile PATH |
Password file for this invocation | per-key config, then SOW_GPG_PASSFILE |
--json |
Output JSON | false |
Abandon a transition with –abort
--abort abandons an unfinished layout plan before its commit decision; once commit intent is
recorded, only forward recovery is possible. It never undoes a completed schema migration, and
the public tree stays unchanged. Without a resumable transition it fails with exit 6.
- For an earlier C2 transition, SOW checks the repository identity and the journal and database control records that exist. Conflicting records stop the abort, and a journal-bound plan also needs its recorded base manifest.
- An abort can complete before the first journal or base manifest was written, as long as the
trusted transition marker exists. SOW keeps that marker so a later
sow repo migrate NAMEcan plan and resume the transition. - A non-empty temporary stage is moved intact into
.sow/<repo>/abandoned/. Retained paths and cleanup problems are printed to stderr and listed in JSONwarnings; a cleanup warning does not prevent the abort. Inspect the reported paths before removing anything.
A fresh development-era C2 repository cannot start a migration. If a previous abort removed the trusted marker, restore a complete matching backup or import the original packages into a new workspace.
Exit codes
| Code | Trigger |
|---|---|
0 |
Listed, created, shown, migrated, abandoned a pre-commit transition, or removed; or repo new reported an existing repository |
1 |
Runtime I/O error creating or removing the tree |
2 |
Usage error (including -r on repo ls, repo new, or repo rm), workspace not found, or an ambiguous repository selection |
4 |
Workspace lock held and --no-wait given or --timeout expired |
5 |
Integrity or recovery error in the workspace journal |
6 |
Invalid or reserved name, unknown repository, non-empty without -f, protected, NAME conflicting with -r, migration required before a write, or --abort with nothing to abandon |
See also
- sow dist — the layer below
- Standard Repositories — the three-layer model and discovery rules
- Transactions & Recovery — lock scopes and the
recoveringstate - sow.yml Reference —
protectedand per-repository signing - Repository Layout — the fixed directory structure