docs: fix/improve references chapter a little bit
This commit is contained in:
@@ -2,26 +2,16 @@
|
|||||||
References
|
References
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
|
||||||
.. automethod:: pygit2.Repository.listall_references
|
.. automethod:: pygit2.Repository.listall_references
|
||||||
.. automethod:: pygit2.Repository.lookup_reference
|
.. automethod:: pygit2.Repository.lookup_reference
|
||||||
|
|
||||||
Reference lookup::
|
Example::
|
||||||
|
|
||||||
>>> all_refs = repo.listall_references()
|
>>> all_refs = repo.listall_references()
|
||||||
>>> master_ref = repo.lookup_reference("refs/heads/master")
|
>>> master_ref = repo.lookup_reference("refs/heads/master")
|
||||||
>>> commit = repo[master_ref.oid]
|
>>> commit = repo[master_ref.target]
|
||||||
|
|
||||||
Reference log::
|
|
||||||
|
|
||||||
>>> head = repo.lookup_reference('refs/heads/master')
|
|
||||||
>>> for entry in head.log():
|
|
||||||
... print(entry.message)
|
|
||||||
|
|
||||||
Shortcuts::
|
|
||||||
|
|
||||||
>>> # These two lines are equivalent
|
|
||||||
>>> head = repo.head
|
|
||||||
>>> head = repo.lookup_reference('HEAD').resolve()
|
|
||||||
|
|
||||||
|
|
||||||
The Reference type
|
The Reference type
|
||||||
@@ -38,7 +28,12 @@ The Reference type
|
|||||||
|
|
||||||
|
|
||||||
The HEAD
|
The HEAD
|
||||||
--------------------
|
====================
|
||||||
|
|
||||||
|
Example. These two lines are equivalent::
|
||||||
|
|
||||||
|
>>> head = repo.lookup_reference('HEAD').resolve()
|
||||||
|
>>> head = repo.head
|
||||||
|
|
||||||
.. autoattribute:: pygit2.Repository.head
|
.. autoattribute:: pygit2.Repository.head
|
||||||
.. autoattribute:: pygit2.Repository.head_is_detached
|
.. autoattribute:: pygit2.Repository.head_is_detached
|
||||||
@@ -46,7 +41,13 @@ The HEAD
|
|||||||
|
|
||||||
|
|
||||||
The reference log
|
The reference log
|
||||||
--------------------
|
====================
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
>>> head = repo.lookup_reference('refs/heads/master')
|
||||||
|
>>> for entry in head.log():
|
||||||
|
... print(entry.message)
|
||||||
|
|
||||||
.. autoattribute:: pygit2.RefLogEntry.oid_new
|
.. autoattribute:: pygit2.RefLogEntry.oid_new
|
||||||
.. autoattribute:: pygit2.RefLogEntry.oid_old
|
.. autoattribute:: pygit2.RefLogEntry.oid_old
|
||||||
|
@@ -195,7 +195,10 @@ Reference_resolve(Reference *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(Reference_target__doc__, "Target.");
|
PyDoc_STRVAR(Reference_target__doc__,
|
||||||
|
"The reference target: If direct the value will be an Oid object, if it\n"
|
||||||
|
"is symbolic it will be an string with the full name of the target\n"
|
||||||
|
"reference.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Reference_target__get__(Reference *self)
|
Reference_target__get__(Reference *self)
|
||||||
@@ -264,7 +267,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(Reference_name__doc__, "The full name of a reference.");
|
PyDoc_STRVAR(Reference_name__doc__, "The full name of the reference.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Reference_name__get__(Reference *self)
|
Reference_name__get__(Reference *self)
|
||||||
@@ -275,7 +278,7 @@ Reference_name__get__(Reference *self)
|
|||||||
|
|
||||||
|
|
||||||
PyDoc_STRVAR(Reference_type__doc__,
|
PyDoc_STRVAR(Reference_type__doc__,
|
||||||
"Type (GIT_REF_OID or GIT_REF_SYMBOLIC).");
|
"Type, either GIT_REF_OID or GIT_REF_SYMBOLIC.");
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
Reference_type__get__(Reference *self)
|
Reference_type__get__(Reference *self)
|
||||||
|
Reference in New Issue
Block a user