2026-10-06 11:02:13 -06:00
|
|
|
from dataclasses import dataclass, field
|
|
|
|
|
from typing import Optional, List
|
Add a Repos module that mirrors git repositories (backend)
A Repo is a Collection (kind='repo') plus a `repository` row, kept up to
date by a recurring Download handled by the new `git` downloader.
* Full history by default (all branches and tags, no --prune; a force
push saves the old HEAD under refs/wrolpi/backup/); snapshot mode
(--depth 1) and a pinned branch are optional. `/tree/<branch>` URLs
select a branch.
* git runs HTTPS-only, never prompts, never runs hooks, and checks out
symlinks as plain files. Upstream disappearing defers the download
with git's error; the local copy is kept.
* Repos are cloned to `repos_destination` (repos/%(repo_tag)s/%(repo_name)s)
and the `repos` directory is always ignored, so repo files are never
indexed.
* repos.yaml is the source of truth (import, dump, backup restore).
* /api/repos: list, create, get, edit, delete (files kept unless
delete_files), update now, and a per-directory file tree. Tagging uses
the collections tag endpoint.
Also:
* run_command/process_runner can merge stderr into stdout (git writes
progress to stderr).
* move_collection deletes an old directory that only holds empty
directories (the move left an emptied .git behind).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 10:52:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class RepoCreateRequest:
|
|
|
|
|
url: str
|
|
|
|
|
tag_name: Optional[str] = None
|
|
|
|
|
frequency: Optional[int] = None
|
|
|
|
|
mode: Optional[str] = None
|
|
|
|
|
branch: Optional[str] = None
|
|
|
|
|
name: Optional[str] = None
|
|
|
|
|
description: Optional[str] = None
|
2026-10-06 16:27:38 -06:00
|
|
|
submodules: bool = False
|
Add a Repos module that mirrors git repositories (backend)
A Repo is a Collection (kind='repo') plus a `repository` row, kept up to
date by a recurring Download handled by the new `git` downloader.
* Full history by default (all branches and tags, no --prune; a force
push saves the old HEAD under refs/wrolpi/backup/); snapshot mode
(--depth 1) and a pinned branch are optional. `/tree/<branch>` URLs
select a branch.
* git runs HTTPS-only, never prompts, never runs hooks, and checks out
symlinks as plain files. Upstream disappearing defers the download
with git's error; the local copy is kept.
* Repos are cloned to `repos_destination` (repos/%(repo_tag)s/%(repo_name)s)
and the `repos` directory is always ignored, so repo files are never
indexed.
* repos.yaml is the source of truth (import, dump, backup restore).
* /api/repos: list, create, get, edit, delete (files kept unless
delete_files), update now, and a per-directory file tree. Tagging uses
the collections tag endpoint.
Also:
* run_command/process_runner can merge stderr into stdout (git writes
progress to stderr).
* move_collection deletes an old directory that only holds empty
directories (the move left an emptied .git behind).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 10:52:10 -06:00
|
|
|
|
|
|
|
|
|
2026-10-06 11:02:13 -06:00
|
|
|
@dataclass
|
|
|
|
|
class RepoSearchRequest:
|
|
|
|
|
search_str: Optional[str] = None
|
|
|
|
|
tag_names: List[str] = field(default_factory=list)
|
|
|
|
|
limit: int = 20
|
|
|
|
|
offset: int = 0
|
|
|
|
|
|
|
|
|
|
|
Add a Repos module that mirrors git repositories (backend)
A Repo is a Collection (kind='repo') plus a `repository` row, kept up to
date by a recurring Download handled by the new `git` downloader.
* Full history by default (all branches and tags, no --prune; a force
push saves the old HEAD under refs/wrolpi/backup/); snapshot mode
(--depth 1) and a pinned branch are optional. `/tree/<branch>` URLs
select a branch.
* git runs HTTPS-only, never prompts, never runs hooks, and checks out
symlinks as plain files. Upstream disappearing defers the download
with git's error; the local copy is kept.
* Repos are cloned to `repos_destination` (repos/%(repo_tag)s/%(repo_name)s)
and the `repos` directory is always ignored, so repo files are never
indexed.
* repos.yaml is the source of truth (import, dump, backup restore).
* /api/repos: list, create, get, edit, delete (files kept unless
delete_files), update now, and a per-directory file tree. Tagging uses
the collections tag endpoint.
Also:
* run_command/process_runner can merge stderr into stdout (git writes
progress to stderr).
* move_collection deletes an old directory that only holds empty
directories (the move left an emptied .git behind).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 10:52:10 -06:00
|
|
|
@dataclass
|
|
|
|
|
class RepoUpdateRequest:
|
|
|
|
|
description: Optional[str] = None
|
|
|
|
|
frequency: Optional[int] = None
|
|
|
|
|
mode: Optional[str] = None
|
|
|
|
|
branch: Optional[str] = None
|
2026-10-06 16:27:38 -06:00
|
|
|
submodules: Optional[bool] = None
|
repos: import an existing git clone as a Repo
POST /api/repos/import/inspect reports what importing a clone in the
media directory would do, without changing it: its origin (an SSH or
git:// origin is converted to https://), branch, latest commit, commits
not on the remote, whether it is shallow, and where it will be moved.
It refuses special directories, Collections' directories, `.git`
files/links, bare repos, and partial clones. It runs no git command
which could run a program from the clone's config (the latest commit is
read with cat-file, not log).
POST /api/repos/import (confirmed, with a URL that is the clone's
origin) moves the clone into the Repos directory (the old location is
refreshed away), sanitizes its config, points origin at the URL, marks
it as WROLPi's, and creates the Repo and its Download. The Repo shows
the clone's commit and README at once; its first update makes it a
mirror (local work is discarded, and the page warns of local commits).
The Repos page has an Import button; the Import page inspects the
chosen directory, then imports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 18:09:52 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class RepoImportInspectRequest:
|
|
|
|
|
directory: str
|
|
|
|
|
name: Optional[str] = None
|
|
|
|
|
tag_name: Optional[str] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
|
class RepoImportRequest:
|
|
|
|
|
directory: str
|
|
|
|
|
confirm: bool = False
|
|
|
|
|
url: Optional[str] = None
|
|
|
|
|
tag_name: Optional[str] = None
|
|
|
|
|
frequency: Optional[int] = None
|
|
|
|
|
mode: Optional[str] = None
|
|
|
|
|
branch: Optional[str] = None
|
|
|
|
|
submodules: bool = False
|
|
|
|
|
name: Optional[str] = None
|
|
|
|
|
description: Optional[str] = None
|