class NamespacedRefsContainer(RefsContainer):
Constructor: NamespacedRefsContainer(refs, namespace)
Wrapper that adds namespace prefix to all ref operations.
This implements Git's GIT_NAMESPACE feature, which stores refs under refs/namespaces/<namespace>/ and filters operations to only show refs within that namespace.
Example
With namespace "foo", a ref "refs/heads/master" is stored as "refs/namespaces/foo/refs/heads/master" in the underlying container.
| Method | __init__ |
Initialize NamespacedRefsContainer. |
| Method | add |
Add a new reference only if it does not already exist. |
| Method | add |
Add packed refs with namespace prefix. |
| Method | allkeys |
Return all reference keys in this namespace. |
| Method | get |
Get packed refs within this namespace. |
| Method | get |
Return the cached peeled value of a ref. |
| Method | pack |
Pack loose refs into packed-refs file. |
| Method | read |
Read a loose reference. |
| Method | remove |
Remove a refname only if it currently equals old_ref. |
| Method | set |
Set a refname to new_ref only if it currently equals old_ref. |
| Method | set |
Make a ref point at another ref. |
| Method | _apply |
Apply namespace prefix to a ref name. |
| Method | _strip |
Remove namespace prefix from a ref name. |
| Instance Variable | _namespace |
Undocumented |
| Instance Variable | _refs |
Undocumented |
Inherited from RefsContainer:
| Method | __contains__ |
Check if a reference exists. |
| Method | __delitem__ |
Remove a refname. |
| Method | __getitem__ |
Get the SHA1 for a reference name. |
| 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 | follow |
Follow a reference name. |
| 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 | 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.__init__Initialize NamespacedRefsContainer.
| Parameters | |
refs:RefsContainer | The underlying refs container to wrap |
namespace:bytes | The namespace prefix (e.g., b"foo" or b"foo/bar") |
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 new reference only if it does not already exist.
dulwich.refs.RefsContainer.pack_refsPack loose refs into packed-refs file.
Note: This packs all refs in the underlying container, not just those in the namespace.
Ref, old_ref: ObjectID | None, committer: bytes | None = None, timestamp: int | None = None, timezone: int | None = None, message: bytes | None = None) -> bool:
¶
Remove a refname only if it currently 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_equalsSet a refname to new_ref only if it currently equals old_ref.
Ref, other: Ref, committer: bytes | None = None, timestamp: int | None = None, timezone: int | None = None, message: bytes | None = None):
¶
Make a ref point at another ref.