Management Commands
All administrative tasks are performed through the pw command.
- --version
Print the patchwork version and exit.
- -S, --syslog
Redirect logging to syslog.
Database
pw db sync
Create or update the database schema. On a fresh database, this creates all tables. On an existing one, it applies pending migrations.
pw db export
Export data from a Django 3.2 patchwork database as SQL statements. This is used during migration from the Python version to the Go version. The output is written to stdout. Foreign key constraints are disabled during the import transaction to speed up bulk loading.
- --dialect <auto|postgres|mysql|sqlite>
Target SQL dialect. By default, the dialect is detected from the database connection. PostgreSQL exports use the COPY protocol for speed; MySQL and SQLite exports use INSERT statements. Identifier quoting matches the target dialect. Override this when the target database differs from the source.
pw db import
Import SQL data from stdin into the current database. Used to load data previously exported with pw db export into a fresh 4.0 database.
For large databases, prefer using the native database client (psql, mysql,
sqlite3) which streams the input instead of loading it entirely in memory.
User Management
pw admin user list
List all users.
pw admin user create -u <username> -e <email>
Create a new user. Prompts for a password interactively.
- -u, --username <username>
Username.
- -e, --email <email>
Email address.
- --admin
Grant admin privileges.
pw admin user delete <username>
Delete a user.
- <username>
Username to delete.
- -f, --force
Skip confirmation.
pw admin user passwd <username>
Change a user’s password interactively.
- <username>
Username to change password for.
Project Management
pw admin project list
List all projects.
pw admin project show <linkname>
Show full details for a project.
- <linkname>
Project linkname.
pw admin project create -n <name> -l <linkname> -e <email>
Create a new project.
- -n, --name <name>
Display name (required).
- -l, --linkname <linkname>
URL-safe identifier (required).
- -i, --list-id <id>
Mailing list ID (required).
- -e, --list-email <email>
Mailing list email address (required).
- --web-url <url>
Project website URL.
- --scm-url <url>
Source code management URL.
- --webscm-url <url>
Web SCM URL.
- --list-archive-url <url>
List archive URL.
- --subject-match <regex>
Subject filter regex.
- --commit-url-format <format>
Commit URL format string.
pw admin project update <linkname> ...
Update an existing project’s fields.
- <linkname>
Project linkname.
- -n, --name <name>
Display name.
- --list-id <id>
Mailing list ID.
- --list-email <email>
Mailing list email address.
- --web-url <url>
Project website URL.
- --scm-url <url>
Source code management URL.
- --webscm-url <url>
Web SCM URL.
- --list-archive-url <url>
List archive URL.
- --subject-match <regex>
Subject filter regex.
- --commit-url-format <format>
Commit URL format string.
pw admin project delete <linkname>
Delete a project.
- <linkname>
Project linkname.
- -f, --force
Skip confirmation.
States
pw admin state list
List all patch states.
pw admin state create -n <name> -s <slug> -o <ordering>
Create a new state.
- -n, --name <name>
State name (required).
- -s, --slug <slug>
URL-safe slug (required).
- -o, --ordering <number>
Sort order (required).
- --action-required
Whether this state requires action.
pw admin state delete <slug>
Delete a state.
- <slug>
State slug to delete.
- -f, --force
Skip confirmation.
Maintainers
pw admin maintainer list <project>
List maintainers for a project.
- <project>
Project linkname.
pw admin maintainer add <project> <username>
Add a maintainer to a project.
- <project>
Project linkname.
- <username>
Username to add as maintainer.
pw admin maintainer remove <project> <username>
Remove a maintainer from a project.
- <project>
Project linkname.
- <username>
Username to remove.
Delegation Rules
pw admin delegate-rule list <project>
List autodelegation rules for a project.
- <project>
Project linkname.
pw admin delegate-rule create
Create a delegation rule.
- --project <linkname>
Project linkname (required).
- --user <username>
Delegate username (required).
- --path <pattern>
File path pattern (required).
- --priority <number>
Rule priority; lower values are higher priority (default: 0).
pw admin delegate-rule delete <id>
Delete a delegation rule.
- <id>
Rule ID to delete.
- -f, --force
Skip confirmation.
Webhooks
pw admin webhook list [<project>]
List webhooks.
- <project>
Project linkname. When omitted, list webhooks for all projects.
pw admin webhook create --project <linkname> --url <url> --user <username>
Create a webhook.
- --project <linkname>
Project linkname (required).
- --user <username>
Creator username (required).
- --url <url>
Webhook endpoint URL (required).
- --secret <secret>
Secret for HMAC signatures.
- --events <events>
Comma-separated event categories, or
*for all. Use?to list all supported events (default:*).
- --active, --no-active
Whether the webhook is active (default: true).
pw admin webhook update <id> ...
Update a webhook.
- <id>
Webhook ID.
- --url <url>
Webhook endpoint URL.
- --secret <secret>
Secret for HMAC signatures.
- --events <events>
Comma-separated event categories, or
*for all. Use?to list all supported events.
- --active, --no-active
Whether the webhook is active.
pw admin webhook delete <id>
Delete a webhook.
- <id>
Webhook ID to delete.
- -f, --force
Skip confirmation.
Garbage Collection
pw admin gc
Clean up expired sessions, stale email confirmations, inactive users with no pending confirmation, and old events. Run this periodically via cron or a systemd timer.
- --event-max-age <duration>
Override
[database].event-max-agefor this run.
Email Ingress
pw ingress
Start the SMTP daemon for receiving emails (long-running service). When neither
--stdin nor --mbox is given, the daemon listens on the
address configured with [ingress].listen.
- -i, --stdin
Read a single email from stdin and exit.
- -m, --mbox
Read all emails in mbox format from stdin.
- -l, --list-id <id>
Force List-ID value instead of reading it from email headers.
Configuration
pw config
Print a default, annotated configuration file to stdout.
pw config url
Generate a database connection URL interactively.
HTTP Server
pw http
Start the HTTP server exposing the web interface and REST API. The listen
address is controlled by [http].listen and other settings such as
[http].base-url, [http].custom-css, [http].nav-html
and [http].footer-html.