class RefsContainer(object):
Known subclasses: dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
, dulwich.refs.InfoRefsContainer
A container for refs.
Method | __contains__ |
Undocumented |
Method | __delitem__ |
Remove a refname. |
Method | __getitem__ |
Get the SHA1 for a reference name. |
Method | __init__ |
Undocumented |
Method | __iter__ |
Undocumented |
Method | __setitem__ |
Set a reference name to point to the given SHA1. |
Method | add |
Add a new reference only if it does not already exist. |
Method | allkeys |
All refs present in this container. |
Method | as |
Return the contents of this container as a dictionary. |
Method | follow |
Follow a reference name. |
Method | get |
Get contents of the packed-refs file. |
Method | get |
Return the cached peeled value of a ref, if available. |
Method | get |
Get a dict with all symrefs in this container. |
Method | import |
Undocumented |
Method | keys |
Refs present in this container. |
Method | read |
Read a loose reference and return its contents. |
Method | read |
Read a reference without following any references. |
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 | 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 |
Remove a refname.
This method does not follow symbolic references, even if applicable for the subclass.
- Note: This method unconditionally deletes the contents of a reference.
- To delete atomically only if the reference has not changed, use remove_if_equals().
Parameters | |
name | The refname to delete. |
dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
, dulwich.refs.InfoRefsContainer
Undocumented
Set a reference name to point to the given SHA1.
This method follows all symbolic references if applicable for the subclass.
- Note: This method unconditionally overwrites the contents of a
- reference. To update atomically only if the reference has not changed, use set_if_equals().
Parameters | |
name | The refname to set. |
ref | The new sha the refname will refer to. |
dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
Add a new reference only if it does not already exist.
Parameters | |
name | Ref name |
ref | Ref value |
committer | Undocumented |
timestamp | Undocumented |
timezone | Undocumented |
message | Undocumented |
dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
, dulwich.refs.InfoRefsContainer
All refs present in this container.
Follow a reference name.
- Returns: a tuple of (refnames, sha), wheres refnames are the names of
- references in the chain
dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
, dulwich.refs.InfoRefsContainer
Get contents of the packed-refs file.
Returns: Dictionary mapping ref names to SHA1s
- Note: Will return an empty dictionary when no packed-refs file is
- present.
dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
, dulwich.refs.InfoRefsContainer
Return 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 | Name of the ref to peel |
Refs present in this container.
- Returns: An unsorted set of valid refs in this container, including
- packed refs.
Parameters | |
base | An optional base to return refs under. |
dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
, dulwich.refs.InfoRefsContainer
Read a loose reference and return its contents.
- Returns: The contents of the ref file, or None if it does
- not exist.
Parameters | |
name | the refname to read |
Read a reference without following any references.
- Returns: The contents of the ref file, or None if it does
- not exist.
Parameters | |
refname | The name of the reference |
dulwich.contrib.swift.SwiftInfoRefsContainer
, dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
Remove a refname only if it currently equals old_ref.
This method does not follow symbolic references, even if applicable for the subclass. It can be used to perform an atomic compare-and-delete operation.
Returns: True if the delete was successful, False otherwise.
Parameters | |
name | The refname to delete. |
old | The old sha the refname must refer to, or None to delete unconditionally. |
committer | Undocumented |
timestamp | Undocumented |
timezone | Undocumented |
message | Message for reflog |
dulwich.contrib.swift.SwiftInfoRefsContainer
, dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
Set a refname to new_ref only if it currently equals old_ref.
This method follows all symbolic references if applicable for the subclass, and can be used to perform an atomic compare-and-swap operation.
Returns: True if the set was successful, False otherwise.
Parameters | |
name | The refname to set. |
old | The old sha the refname must refer to, or None to set unconditionally. |
new | The new sha the refname will refer to. |
committer | Undocumented |
timestamp | Undocumented |
timezone | Undocumented |
message | Message for reflog |
dulwich.refs.DictRefsContainer
, dulwich.refs.DiskRefsContainer
Make a ref point at another ref.
Parameters | |
name | Name of the ref to set |
other | Name of the ref to point at |
committer | Undocumented |
timestamp | Undocumented |
timezone | Undocumented |
message | Optional message |
dulwich.refs.DiskRefsContainer
Refs present in this container under a base.
- Returns: A set of valid refs in this container under the base; the base
- prefix is stripped from the ref names returned.
Parameters | |
base | The base to return refs under. |
Ensure a refname is valid and lives in refs or is HEAD.
HEAD is not a valid refname according to git-check-ref-format, but this class needs to be able to touch HEAD. Also, check_ref_format expects refnames without the leading 'refs/', but this class requires that so it cannot touch anything outside the refs dir (or HEAD).
Parameters | |
name | The name of the reference. |
Raises | |
KeyError | if a refname is not HEAD or is otherwise not valid. |