lockfile
lockfile
Helpers for reading and writing the syncweaver lockfile.
Functions
| Name | Description |
|---|---|
| load_existing_lockfile | Read lockfile JSON from disk and fail when it does not exist. |
| read_lockfile | Read lockfile if present, otherwise create a default payload. |
| resolve_source_path_from_lockfile | Resolve the tracked source path for a sync operation. |
| resolve_source_paths_from_lockfile | Resolve one or more tracked source paths for a sync operation. |
| write_lockfile | Write lockfile JSON with a stable format. |
load_existing_lockfile
lockfile.load_existing_lockfile(lockfile)Read lockfile JSON from disk and fail when it does not exist.
read_lockfile
lockfile.read_lockfile(lockfile, cwd, run_git)Read lockfile if present, otherwise create a default payload.
resolve_source_path_from_lockfile
lockfile.resolve_source_path_from_lockfile(lockfile, source_path, repo_url=None)Resolve the tracked source path for a sync operation.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| lockfile | pathlib.Path | Path to the syncweaver lockfile. | required |
| source_path | str | None | Optional requested source path from CLI or workflow inputs. | required |
| repo_url | str | None | Optional repository URL used to select a matching source path when source_path is omitted. | None |
Returns
| Name | Type | Description |
|---|---|---|
| str | str | Resolved source path to update. |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If source_path is not provided and lockfile content cannot determine a single tracked source path. |
resolve_source_paths_from_lockfile
lockfile.resolve_source_paths_from_lockfile(
lockfile,
source_path,
repo_url=None,
)Resolve one or more tracked source paths for a sync operation.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| lockfile | pathlib.Path | Path to the syncweaver lockfile. | required |
| source_path | str | None | Optional requested source path from CLI or workflow inputs. | required |
| repo_url | str | None | Optional repository URL used to select matching source paths when source_path is omitted. | None |
Returns
| Name | Type | Description |
|---|---|---|
| list[str] | list[str]: Resolved source path list. |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If source_path is not provided and lockfile content cannot determine matching tracked source paths. |
write_lockfile
lockfile.write_lockfile(lockfile, data)Write lockfile JSON with a stable format.