Fix document generation and move example to pydoc

- Fix issues introduced in prev commit
- Move all documentation for Repository.walk from log.rst to
  pydoc in repository.c to make it available in both html and pydoc
- Extend documentation with sort types description
This commit is contained in:
Andrey Devyatkin
2013-05-18 01:05:59 +02:00
parent 785b5112ab
commit 80574613f4
2 changed files with 19 additions and 10 deletions

View File

@@ -3,9 +3,3 @@ Commit log
********************************************************************** **********************************************************************
.. automethod:: pygit2.Repository.walk .. automethod:: pygit2.Repository.walk
You can iterate through the revision history with repo.walk::
>>> from pygit2 import GIT_SORT_TIME
>>> for commit in repo.walk(oid, GIT_SORT_TIME):
... print(commit.hex)

View File

@@ -541,13 +541,28 @@ PyDoc_STRVAR(Repository_walk__doc__,
"walk(oid, sort_mode) -> iterator\n" "walk(oid, sort_mode) -> iterator\n"
"\n" "\n"
"Generator that traverses the history starting from the given commit.\n" "Generator that traverses the history starting from the given commit.\n"
"The following types of sorting could be used to control traversing\n"
"direction:\n"
"\n"
"* GIT_SORT_NONE. This is the default sorting for new walkers\n"
" Sort the repository contents in no particular ordering\n"
"* GIT_SORT_TOPOLOGICAL. Sort the repository contents in topological order\n"
" (parents before children); this sorting mode can be combined with\n"
" time sorting.\n"
"* GIT_SORT_TIME. Sort the repository contents by commit time\n"
"* GIT_SORT_REVERSE. Iterate through the repository contents in reverse\n"
" order; this sorting mode can be combined with any of the above.\n"
"\n" "\n"
"Example:\n" "Example:\n"
"\n" "\n"
"import pygit2" " >>> from pygit2 import Repository\n"
"repo = pygit2.Repository(.git)\n" " >>> from pygit2 import GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE\n"
"for object in repo.walk(repo.head.oid, pygit2.GIT_SORT_TOPOLOGICAL):\n" " >>> repo = Repository('.git')\n"
" print object.message"); " >>> for commit in repo.walk(repo.head.oid, GIT_SORT_TOPOLOGICAL):\n"
" ... print commit.message\n"
" >>> for commit in repo.walk(repo.head.oid, GIT_SORT_TOPOLOGICAL | GIT_SORT_REVERSE):\n"
" ... print commit.message\n"
" >>>\n");
PyObject * PyObject *
Repository_walk(Repository *self, PyObject *args) Repository_walk(Repository *self, PyObject *args)