Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for "general" page in documentation #375

Merged
merged 5 commits into from
Jun 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion docs/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,45 @@ General
:local:


Top level constants and exceptions from the library.

Constants
=========

The following constants provide information about the version of the libgit2
library that has been built against. The version number has a
``MAJOR.MINOR.REVISION`` format.

.. py:data:: LIBGIT2_VER_MAJOR

Integer value of the major version number. For example, for the version
``0.20.0``::

>>> print LIBGIT2_VER_MAJOR
0

.. py:data:: LIBGIT2_VER_MINOR

Integer value of the minor version number. For example, for the version
``0.20.0``::

>>> print LIBGIT2_VER_MINOR
20

.. py:data:: LIBGIT2_VER_REVISION
.. py:data:: LIBGIT2_VER_VERSION

Integer value of the revision version number. For example, for the version
``0.20.0``::

>>> print LIBGIT2_VER_REVISION
0

.. py:data:: LIBGIT2_VERSION

The libgit2 version number as a string::

>>> print LIBGIT2_VERSION
'0.20.0'

Errors
======
Expand All @@ -22,3 +53,4 @@ Errors
:members:
:show-inheritance:
:undoc-members:

19 changes: 18 additions & 1 deletion docs/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ The Reference type
.. automethod:: pygit2.Reference.resolve
.. automethod:: pygit2.Reference.log
.. automethod:: pygit2.Reference.log_append

Example::

>>> branch = repository.lookup_reference("refs/heads/master")
>>> branch.target = another_commit.id
>>> committer = Signature('Cecil Committer', '[email protected]')
>>> branch.log_append(another_commit.id, committer,
"changed branch target using pygit2")

This creates a reflog entry in ``git reflog master`` which looks like::

7296b92 master@{10}: changed branch target using pygit2

In order to make an entry in ``git reflog``, ie. the reflog for ``HEAD``, you
have to get the Reference object for ``HEAD`` and call ``log_append`` on
that.

.. automethod:: pygit2.Reference.get_object


Expand All @@ -45,7 +62,7 @@ Example. These two lines are equivalent::
Branches
====================

Branches inherit from References, and additionally provide spetialized
Branches inherit from References, and additionally provide specialized
accessors for some unique features.

.. automethod:: pygit2.Repository.listall_branches
Expand Down
5 changes: 5 additions & 0 deletions docs/repository.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Functions

.. autofunction:: pygit2.discover_repository

Example::

>>> current_working_directory = os.getcwd()
>>> repository_path = discover_repository(current_working_directory)
>>> repo = Repository(repository_path)


The Repository class
Expand Down
5 changes: 4 additions & 1 deletion src/reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ Reference_resolve(Reference *self, PyObject *args)
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.");
"reference.\n"
"\n"
"The target is writable. Setting the Reference's target to another Oid\n"
"object will direct the reference to that Oid instead.");

PyObject *
Reference_target__get__(Reference *self)
Expand Down