class ReftableRefsContainer(RefsContainer):
Constructor: ReftableRefsContainer(path, logger)
A refs container backed by the reftable format.
| Method | __getitem__ |
Get the SHA1 for a reference name. |
| Method | __init__ |
Initialize a reftable refs container. |
| Method | add |
Add a ref only if it doesn't exist. |
| Method | add |
Add packed refs. Creates a new reftable file with all refs consolidated. |
| Method | allkeys |
Return set of all ref names. |
| Method | batch |
Context manager for batching multiple ref updates into a single reftable. |
| Method | follow |
Follow a reference name. |
| Method | get |
Get packed refs. Reftable doesn't distinguish packed/loose. |
| Method | get |
Return the cached peeled value of a ref, if available. |
| Method | read |
Read a reference value without following symbolic refs. |
| Method | remove |
Remove a ref if it equals old_ref. |
| Method | remove |
Remove a packed ref. Creates a deletion record. |
| Method | set |
Atomically set a ref if it currently equals old_ref. |
| Method | set |
Set a symbolic reference. |
| Instance Variable | path |
Undocumented |
| Instance Variable | reftable |
Undocumented |
| Method | _apply |
Apply batch updates to the refs dict and update indices. |
| Method | _compact |
Compact tables list to single file like Git does. |
| Method | _ensure |
Ensure refs/heads marker file exists for Git compatibility. |
| Method | _flush |
Flush pending ref updates like Git does - consolidate all refs. |
| Method | _generate |
Generate a new reftable file path. |
| Method | _get |
Get the next available update index across all tables. |
| Method | _get |
Get sorted list of reftable files from tables.list. |
| Method | _load |
Load the update indices for all refs from existing reftable files. |
| Method | _process |
Process pending updates and return (head_update, other_updates). |
| Method | _read |
Read all reftable files and merge results. |
| Method | _read |
Context manager helper to open and read a reftable file. |
| Method | _resolve |
Resolve a symbolic reference chain to its final target. |
| Method | _update |
Update the tables.list file with current table files. |
| Method | _write |
Write all refs to a single batch file and return created filenames. |
| Method | _write |
Write multiple ref updates to a single reftable file. |
| Method | _write |
Write a single ref update immediately to its own reftable file. |
| Method | _write |
Write a single ref update to its own reftable file like Git does. |
| Instance Variable | _batch |
Undocumented |
| Instance Variable | _pending |
Undocumented |
| Instance Variable | _ref |
Undocumented |
Inherited from RefsContainer:
| Method | __contains__ |
Check if a reference exists. |
| Method | __delitem__ |
Remove a refname. |
| Method | __iter__ |
Iterate over all reference keys. |
| Method | __setitem__ |
Set a reference name to point to the given SHA1. |
| Method | as |
Return the contents of this container as a dictionary. |
| Method | get |
Get a dict with all symrefs in this container. |
| Method | import |
Import refs from another repository. |
| Method | keys |
Refs present in this container. |
| Method | pack |
Pack loose refs into packed-refs file. |
| Method | read |
Read a reference without following any references. |
| Method | subkeys |
Refs present in this container under a base. |
| Method | _check |
Ensure a refname is valid and lives in refs or is HEAD. |
| Method | _log |
Undocumented |
| Instance Variable | _logger |
Undocumented |
dulwich.refs.RefsContainer.__getitem__Get the SHA1 for a reference name.
This method follows all symbolic references.
Ref, ref: ObjectID, committer: bytes | None = None, timestamp: int | None = None, timezone: int | None = None, message: bytes | None = None) -> bool:
¶
dulwich.refs.RefsContainer.add_if_newAdd a ref only if it doesn't exist.
dulwich.refs.RefsContainer.followFollow a reference name.
- Returns: a tuple of (refnames, sha), where refnames are the names of
- references in the chain
dulwich.refs.RefsContainer.get_peeledReturn the cached peeled value of a ref, if available.
- Returns: The peeled value of the ref. If the ref is known not point to
- a tag, this will be the SHA the ref refers to. If the ref may point to a tag, but no cached information is available, None is returned.
| Parameters | |
name:Ref | Name of the ref to peel |
| Returns | |
ObjectID | None | Undocumented |
Ref, old_ref: ObjectID | None, committer: bytes | None = None, timestamp: int | None = None, timezone: int | None = None, message: bytes | None = None) -> bool:
¶
Remove a ref if it equals old_ref.
Ref, old_ref: ObjectID | None, new_ref: ObjectID, committer: bytes | None = None, timestamp: int | None = None, timezone: int | None = None, message: bytes | None = None) -> bool:
¶
dulwich.refs.RefsContainer.set_if_equalsAtomically set a ref if it currently equals old_ref.
bytes, other: bytes, committer: bytes | None = None, timestamp: int | None = None, timezone: int | None = None, message: bytes | None = None):
¶
Set a symbolic reference.
dict[ bytes, tuple[ int, bytes]], other_updates: list[ tuple[ bytes, int, bytes]], head_update: tuple[ bytes, int, bytes] | None, batch_update_index: int):
¶
Apply batch updates to the refs dict and update indices.
Ensure refs/heads marker file exists for Git compatibility.
Git expects a refs/heads file (not directory) to exist when using reftables. This file contains a marker message indicating that the repository uses the reftable format instead of loose refs.
int | None = None, max_update_index: int | None = None) -> str:
¶
Generate a new reftable file path.
tuple[ tuple[ bytes, int, bytes] | None, list[ tuple[ bytes, int, bytes]]]:
¶
Process pending updates and return (head_update, other_updates).
Resolve a symbolic reference chain to its final target.
Git limits symref chains to 5 levels to prevent infinite loops. This method follows the chain until it finds a non-symbolic ref or hits the depth limit.
| Parameters | |
target:bytes | The initial target of a symbolic reference |
| Returns | |
bytes | The final target after resolving all symbolic references |
dict[ bytes, tuple[ int, bytes]], batch_update_index: int) -> list[ str]:
¶
Write all refs to a single batch file and return created filenames.