kkrunner.files.FileVersion

class kkrunner.files.FileVersion(path, fingerprint, digest=None)[source]

Bases: object

A path together with cheap metadata and authoritative content identity.

fingerprint is a cheap filesystem snapshot used only as a fast path. For regular files captured with the default settings, digest is the SHA-256 identity of the contents. A later metadata change therefore causes content verification rather than by itself making the historical version stale.

Parameters:
path: Path
fingerprint: FileFingerprint | None
digest: str | None = None
classmethod capture(path, *, digest=True, require_digest=False)[source]

Capture path, optionally requiring a stable content digest.

A digest is never associated with metadata observed before or after a concurrent rewrite. Strict callers such as persistent-history capture retry once and then fail instead of degrading to metadata-only identity.

Parameters:
  • path (str | Path)

  • digest (bool)

  • require_digest (bool)

Return type:

FileVersion

property available: bool

Whether this snapshot has usable content identity.

current()[source]

Return this version if current, otherwise capture the version on disk.

Return type:

FileVersion

is_current()[source]
Return type:

bool

state()[source]

Return the current relationship to the captured version.

Return type:

FileState