Skip to content

Commit 239e890

Browse files
committed
Update docs
1 parent 031f785 commit 239e890

12 files changed

+65
-43
lines changed

docs/blame.rst

+2
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ Constants
4444
.. py:data:: GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES
4545
.. py:data:: GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES
4646
.. py:data:: GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES
47+
.. py:data:: GIT_BLAME_FIRST_PARENT
48+
.. py:data:: GIT_BLAME_USE_MAILMAP

docs/branches.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
Branches
33
**********************************************************************
44

5-
.. py:attribute:: Repository.branches
5+
.. autoclass:: pygit2.Repository
6+
:members: lookup_branch, raw_listall_branches
7+
:noindex:
8+
9+
.. attribute:: branches
610

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

docs/index_file.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,16 @@ The Index type
4141
:members:
4242

4343
The IndexEntry type
44-
--------------------
44+
====================
4545

4646
.. autoclass:: pygit2.IndexEntry
4747
:members:
4848

49+
.. automethod:: __eq__
50+
.. automethod:: __ne__
51+
.. automethod:: __repr__
52+
.. automethod:: __str__
53+
4954
Status
5055
====================
5156

docs/objects.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ This is the common interface for all Git objects:
8080

8181
.. autoclass:: pygit2.Object
8282
:members: id, type, type_str, short_id, read_raw, peel, name, filemode
83-
84-
.. automethod:: __eq__(other)
85-
.. automethod:: __ne__(other)
86-
.. automethod:: __hash__()
83+
:special-members: __eq__, __ne__, __hash__, __repr__
8784

8885

8986
Blobs

docs/recipes/git-tag.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ Showing all tags
1212
1313
.. code-block:: python
1414
15-
>>> regex = re.compile('^refs/tags')
16-
>>> filter(lambda r: regex.match(r), repo.listall_references())
15+
>>> import re
16+
>>> regex = re.compile('^refs/tags/')
17+
>>> [r for r in repo.references if regex.match(r)]
1718
1819
----------------------------------------------------------------------
1920
References

docs/references.rst

+18-28
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ References
33
**********************************************************************
44

55
.. autoclass:: pygit2.Repository
6-
:members: lookup_reference, lookup_reference_dwim, resolve_refish
6+
:members: lookup_reference, lookup_reference_dwim, raw_listall_references,
7+
resolve_refish
78
:noindex:
89

9-
.. attribute:: Repository.references
10+
.. attribute:: references
1011

1112
Returns an instance of the References class (see below).
1213

@@ -55,38 +56,27 @@ The Reference type
5556
====================
5657

5758
.. autoclass:: pygit2.Reference
59+
:members:
60+
:special-members: __eq__, __ne__
61+
:exclude-members: log
5862

59-
.. autoattribute:: pygit2.Reference.name
60-
.. autoattribute:: pygit2.Reference.raw_name
61-
.. autoattribute:: pygit2.Reference.shorthand
62-
.. autoattribute:: pygit2.Reference.raw_shorthand
63-
.. autoattribute:: pygit2.Reference.target
64-
.. autoattribute:: pygit2.Reference.type
65-
66-
.. automethod:: pygit2.Reference.__eq__(Reference)
67-
.. automethod:: pygit2.Reference.__ne__(Reference)
68-
.. automethod:: pygit2.Reference.set_target
69-
.. automethod:: pygit2.Reference.delete
70-
.. automethod:: pygit2.Reference.rename
71-
.. automethod:: pygit2.Reference.resolve
72-
.. automethod:: pygit2.Reference.peel
73-
.. automethod:: pygit2.Reference.log
63+
.. automethod:: log
7464

75-
Example::
65+
Example::
7666

77-
>>> branch = repository.references["refs/heads/master"]
78-
>>> branch.target = another_commit.id
79-
>>> committer = Signature('Cecil Committer', '[email protected]')
80-
>>> branch.log_append(another_commit.id, committer,
81-
"changed branch target using pygit2")
67+
>>> branch = repository.references["refs/heads/master"]
68+
>>> branch.target = another_commit.id
69+
>>> committer = Signature('Cecil Committer', '[email protected]')
70+
>>> branch.log_append(another_commit.id, committer,
71+
"changed branch target using pygit2")
8272

83-
This creates a reflog entry in ``git reflog master`` which looks like::
73+
This creates a reflog entry in ``git reflog master`` which looks like::
8474

85-
7296b92 master@{10}: changed branch target using pygit2
75+
7296b92 master@{10}: changed branch target using pygit2
8676

87-
In order to make an entry in ``git reflog``, ie. the reflog for ``HEAD``, you
88-
have to get the Reference object for ``HEAD`` and call ``log_append`` on
89-
that.
77+
In order to make an entry in ``git reflog``, ie. the reflog for ``HEAD``, you
78+
have to get the Reference object for ``HEAD`` and call ``log_append`` on
79+
that.
9080

9181

9282
The HEAD

docs/repository.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ the Checkout section.
5353
Below there are some general attributes and methods:
5454

5555
.. autoclass:: pygit2.Repository
56-
:members: ahead_behind, apply, create_reference, default_signature,
56+
:members: ahead_behind, applies, apply, create_reference, default_signature,
5757
descendant_of, describe, free, is_bare, is_empty, odb, path,
5858
path_is_ignored, reset, revert_commit, state_cleanup, workdir,
5959
write_archive, set_odb, set_refdb

docs/revparse.rst

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22
Revision parsing
33
**********************************************************************
44

5-
.. automethod:: pygit2.Repository.revparse_single
5+
.. autoclass:: pygit2.Repository
6+
:members: revparse, revparse_ext, revparse_single
7+
:noindex:
68

79
You can use any of the fancy `<rev>` forms supported by libgit2::
810

911
>>> commit = repo.revparse_single('HEAD^')
12+
13+
.. autoclass:: pygit2.RevSpec
14+
:members:
15+
16+
17+
Constants:
18+
19+
.. py:data:: GIT_REVPARSE_SINGLE
20+
.. py:data:: GIT_REVPARSE_RANGE
21+
.. py:data:: GIT_REVPARSE_MERGE_BASE

docs/submodule.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Submodules
55
A submodule is a foreign repository that is embedded within a
66
dedicated subdirectory of the repositories tree.
77

8-
.. automethod:: pygit2.Repository.init_submodules
9-
.. automethod:: pygit2.Repository.update_submodules
10-
.. automethod:: pygit2.Repository.lookup_submodule
11-
.. automethod:: pygit2.Repository.listall_submodules
8+
.. autoclass:: pygit2.Repository
9+
:members: add_submodule, init_submodules, listall_submodules, lookup_submodule, update_submodules
10+
:noindex:
11+
1212

1313
The Submodule type
1414
====================

pygit2/repository.py

+10
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def add_submodule(self, url, path, link=True, callbacks=None):
129129
return submodule_instance
130130

131131
def lookup_submodule(self, path):
132+
"""
133+
Lookup submodule information by name or path.
134+
"""
132135
csub = ffi.new('git_submodule **')
133136
cpath = ffi.new('char[]', to_bytes(path))
134137

@@ -137,6 +140,13 @@ def lookup_submodule(self, path):
137140
return Submodule._from_c(self, csub[0])
138141

139142
def update_submodules(self, submodules=None, init=False, callbacks=None):
143+
"""
144+
Update a submodule. This will clone a missing submodule and checkout
145+
the subrepository to the commit specified in the index of the
146+
containing repository. If the submodule repository doesn't contain the
147+
target commit (e.g. because fetchRecurseSubmodules isn't set), then the
148+
submodule is fetched using the fetch options supplied in options.
149+
"""
140150
if submodules is None:
141151
submodules = self.listall_submodules()
142152

src/pygit2.c

+1
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ PyInit__pygit2(void)
429429
* RevSpec
430430
*/
431431
INIT_TYPE(RevSpecType, NULL, NULL)
432+
ADD_TYPE(m, RevSpec)
432433
ADD_CONSTANT_INT(m, GIT_REVPARSE_SINGLE)
433434
ADD_CONSTANT_INT(m, GIT_REVPARSE_RANGE)
434435
ADD_CONSTANT_INT(m, GIT_REVPARSE_MERGE_BASE)

src/revspec.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ RevSpec_to_object__get__(RevSpec *self)
8484
}
8585

8686
PyDoc_STRVAR(RevSpec_flags__doc__,
87-
"A combination of GIT_REVPARSE_ flags which indicate the\n"
87+
"A combination of GIT_REVPARSE_* flags which indicate the\n"
8888
"intended behavior of the spec passed to Repository.revparse()");
8989

9090
PyObject *

0 commit comments

Comments
 (0)