patch

patch

Patch lifecycle logic for syncweaver.

Functions

Name Description
annotate_rejected_patch Annotate a tracked patch as rejected in lockfile extension metadata.
create_patch Create or update a canonical patch file for a tracked vendored source.
list_patches List recorded patches for a tracked source path.
mark_patch_status Record patch lifecycle status metadata in the syncweaver lockfile.

annotate_rejected_patch

patch.annotate_rejected_patch(patch_path, pr_url, reason, lockfile_path)

Annotate a tracked patch as rejected in lockfile extension metadata.

create_patch

patch.create_patch(source_path, repo_url, lockfile_path, patch_dir_override)

Create or update a canonical patch file for a tracked vendored source.

list_patches

patch.list_patches(path, lockfile_path)

List recorded patches for a tracked source path.

mark_patch_status

patch.mark_patch_status(
    patch_path,
    status,
    lockfile_path,
    *,
    pr_url='',
    reason='',
)

Record patch lifecycle status metadata in the syncweaver lockfile.

Parameters

Name Type Description Default
patch_path pathlib.Path Relative patch path tracked in the lockfile. required
status str Patch lifecycle state: local, open, accepted, or rejected. required
lockfile_path pathlib.Path Path to the host repository lockfile. required
pr_url str Optional upstream pull request URL for open or reviewed patches. ''
reason str Optional free-text note, required for rejected patches. ''

Returns

Name Type Description
tuple[str, str] tuple[str, str]: The tracked patch key and the lockfile path written.

Raises

Name Type Description
KeyError If the patch path is not tracked in the lockfile.
ValueError If the requested status metadata is invalid.