module documentation

Annotate file contents indicating when they were last changed.

Annotated lines are represented as tuples with last modified revision SHA1 and contents.

Please note that this is a very naive annotate implementation. It works, but its speed could be improved - in particular because it uses Python's difflib.

Function annotate_lines Annotate the lines of a blob.
Function update_lines Update annotation lines with old blob lines.
def annotate_lines(store: BaseObjectStore, commit_id: ObjectID, path: bytes, order: str = ORDER_DATE, lines: Sequence[tuple[tuple[Commit, TreeEntry], bytes]] | None = None, follow: bool = True) -> list[tuple[tuple[Commit, TreeEntry], bytes]]:

Annotate the lines of a blob.

Parameters
store:BaseObjectStoreObject store to retrieve objects from
commit_id:ObjectIDCommit id in which to annotate path
path:bytesPath to annotate
order:strOrder in which to process history (defaults to ORDER_DATE)
lines:Sequence[tuple[tuple[Commit, TreeEntry], bytes]] | NoneInitial lines to compare to (defaults to specified)
follow:boolWhether to follow changes across renames/copies
Returns
list[tuple[tuple[Commit, TreeEntry], bytes]]List of (commit, line) entries where commit is the oldest commit that changed a line
def update_lines(annotated_lines: Sequence[tuple[tuple[Commit, TreeEntry], bytes]], new_history_data: tuple[Commit, TreeEntry], new_blob: Blob) -> list[tuple[tuple[Commit, TreeEntry], bytes]]:

Update annotation lines with old blob lines.