Sync process supervision

Warning

Be careful with these! Internal APIs are not covered by version policies. They can break or be removed between minor versions!

If you need an internal API stabilized please file an issue.

vcspull._internal.sync_process supervises per-repository CLI mutations in owned POSIX process groups and inspects retained recovery records after timeouts or interrupts.

Own CLI sync workers, native descendants, and streamed output.

class vcspull._internal.sync_process.SyncOutcome
class vcspull._internal.sync_process.SyncOutcome

Bases: object

Keep completed results separate from forced termination and inspection.

exception vcspull._internal.sync_process.SyncInterrupted
exception[source]
exception[source]
exception vcspull._internal.sync_process.SyncInterrupted

Bases: KeyboardInterrupt

Carry retained recovery information through CLI interrupt cleanup.

class vcspull._internal.sync_process._Exchange
class vcspull._internal.sync_process._Exchange

Bases: object

_Exchange(terminal: ‘dict[str, t.Any] | None’, output: ‘str’, timed_out: ‘bool’, returncode: ‘int | None’, interrupted: ‘bool’, protocol_error: ‘str | None’)

vcspull._internal.sync_process._result_from_data(data)
function[source]
function[source]
vcspull._internal.sync_process._result_from_data(data)
Parameters:

data (dict[str, Any])

Return type:

SyncResult

vcspull._internal.sync_process._result_data(result)
function[source]
function[source]
vcspull._internal.sync_process._result_data(result)
Parameters:

result (SyncResult)

Return type:

dict[str, Any]

vcspull._internal.sync_process._worker_command(control_fd)
function[source]
function[source]
vcspull._internal.sync_process._worker_command(control_fd)
Parameters:

control_fd (int)

Return type:

list[str]

vcspull._internal.sync_process._json_default(value)
function[source]
function[source]
vcspull._internal.sync_process._json_default(value)
Parameters:

value (Any)

Return type:

str | dict[str, Any]

vcspull._internal.sync_process._stop_process(process)
function[source]
function[source]
vcspull._internal.sync_process._stop_process(process)

Stop the owned session before reaping its leader or returning to the batch.

Parameters:

process (Popen[bytes])

Return type:

None

vcspull._internal.sync_process._exchange(request, *, timeout, progress_callback, is_human, cancel_event=None)
function[source]
function[source]
vcspull._internal.sync_process._exchange(request, *, timeout, progress_callback, is_human, cancel_event=None)
Parameters:
Return type:

_Exchange

vcspull._internal.sync_process.run_sync_process(repo, *, progress_callback, timeout, is_human, yes=False, worktree=None, cancel_event=None)
function[source]
function[source]
vcspull._internal.sync_process.run_sync_process(repo, *, progress_callback, timeout, is_human, yes=False, worktree=None, cancel_event=None)

Run one owned mutation process; inspect retained records after a timeout.

Parameters:
  • repo (ConfigDict | Mapping) – Normalized repository entry to synchronize.

  • progress_callback (collections.abc.Callable[[str, datetime.datetime], None]) – Callback receiving streamed subprocess output chunks.

  • timeout (float) – Wall-clock deadline in seconds for this process group.

  • is_human (bool) – Whether human-facing log and progress routing is active.

  • yes (bool) – Whether configured dirty: discard policies are authorized.

  • worktree (WorktreeConfigDict | Mapping | None) – Optional single linked worktree entry when running a worktree sync.

  • cancel_event (threading.Event | None) – Optional cooperative cancellation flag polled every 50 ms on SIGINT.

Returns:

Structured status, result, duration, and retained recovery records.

Return type:

SyncOutcome

Raises:
  • SyncInterrupted – Raised when the worker is interrupted by SIGINT or cancel_event.

  • RuntimeError – Raised on non-POSIX platforms or wedged descendant pipes.

vcspull._internal.sync_process._main()
function[source]
function[source]
vcspull._internal.sync_process._main()
Return type:

None