diff --git a/src/patchman/models/config.py b/src/patchman/models/config.py new file mode 100644 index 0000000..7b85027 --- /dev/null +++ b/src/patchman/models/config.py @@ -0,0 +1,16 @@ +from typing import Optional +from pydantic import BaseModel, Field, HttpUrl + + +class UpstreamConfig(BaseModel): + url: HttpUrl = Field(..., description="Git URL of the upstream repository") + branch: str = Field(default="main", description="Upstream branch to track (default: 'main')") + + +class PatchesConfig(BaseModel): + directory: str = Field(default="./patches", description="Path to patch directory") + + +class PatchmanConfig(BaseModel): + upstream: UpstreamConfig + patches: PatchesConfig diff --git a/src/patchman/models/lock.py b/src/patchman/models/lock.py new file mode 100644 index 0000000..b9d069d --- /dev/null +++ b/src/patchman/models/lock.py @@ -0,0 +1,11 @@ +from pydantic import BaseModel, Field +from typing import Literal + + +class UpstreamLock(BaseModel): + last_commit: str = Field(..., min_length=40, max_length=40, pattern="^[0-9a-f]{40}$", + description="Commit hash of the last processed upstream repository") + + +class PatchmanLock(BaseModel): + upstream: UpstreamLock