docs: adjust to recent changes

It seems I have been forgetting to update the documentation with the
last few  changes, so adjust to the oid -> id renaming and add missing
attributes to the listings.
This commit is contained in:
Carlos Martín Nieto 2014-01-25 04:22:54 +01:00
parent 5410128187
commit 1cc112c32f
7 changed files with 18 additions and 7 deletions

View File

@ -22,7 +22,7 @@ merge with the default ones defined in GIT_MERGE_OPTS_INIT libgit2 constant.
Example::
>>> branch_head_hex = '5ebeeebb320790caf276b9fc8b24546d63316533'
>>> branch_oid = self.repo.get(branch_head_hex).oid
>>> branch_oid = self.repo.get(branch_head_hex).id
>>> merge_result = self.repo.merge(branch_oid)
The MergeResult object

View File

@ -78,6 +78,7 @@ New objects are created using an specific API we will see later.
This is the common interface for all Git objects:
.. autoattribute:: pygit2.Object.id
.. autoattribute:: pygit2.Object.oid
.. autoattribute:: pygit2.Object.hex
.. autoattribute:: pygit2.Object.type
@ -170,10 +171,13 @@ Tree entries
------------
.. autoattribute:: pygit2.TreeEntry.name
.. autoattribute:: pygit2.TreeEntry.id
.. autoattribute:: pygit2.TreeEntry.oid
.. autoattribute:: pygit2.TreeEntry.hex
.. autoattribute:: pygit2.TreeEntry.filemode
:class:`TreeEntry` supports comparison against other tree entries.
Example::
>>> tree = commit.tree
@ -181,7 +185,7 @@ Example::
6
>>> for entry in tree: # Iteration
... print(entry.hex, entry.name)
... print(entry.id, entry.name)
...
7151ca7cd3e59f3eab19c485cfbf3cb30928d7fa .gitignore
c36f4cf1e38ec1bb9d9ad146ed572b89ecfc9f18 COPYING
@ -194,7 +198,7 @@ Example::
>>> entry
<pygit2.TreeEntry object at 0xcc10f0>
>>> blob = repo[entry.oid] # Get the object the entry points to
>>> blob = repo[entry.id] # Get the object the entry points to
>>> blob
<pygit2.Blob object at 0xcc12d0>
@ -221,7 +225,9 @@ committer and others.
.. autoattribute:: pygit2.Commit.message_encoding
.. autoattribute:: pygit2.Commit.raw_message
.. autoattribute:: pygit2.Commit.tree
.. autoattribute:: pygit2.Commit.tree_id
.. autoattribute:: pygit2.Commit.parents
.. autoattribute:: pygit2.Commit.parent_ids
.. autoattribute:: pygit2.Commit.commit_time
.. autoattribute:: pygit2.Commit.commit_time_offset

View File

@ -61,8 +61,9 @@ The Oid type
>>> raw = unhexlify("cff3ceaefc955f0dbe1957017db181bc49913781")
>>> oid2 = Oid(raw=raw)
An the other way around, from an Oid object we can get the hexadecimal and raw
forms.
And the other way around, from an Oid object we can get the hexadecimal and raw
forms. You can use the built-in `str()` (or `unicode()` in python 2) to get the
hexadecimal representation of the Oid.
.. autoattribute:: pygit2.Oid.hex
.. autoattribute:: pygit2.Oid.raw

View File

@ -31,7 +31,7 @@ Traverse commit history
.. code-block:: python
>>> last = repo[repo.head.target]
>>> for commit in repo.walk(last.oid, pygit2.GIT_SORT_TIME):
>>> for commit in repo.walk(last.id, pygit2.GIT_SORT_TIME):
>>> print(commit.message) # or some other operation
----------------------------------------------------------------------

View File

@ -12,7 +12,10 @@ The Remote type
.. autoattribute:: pygit2.Remote.name
.. autoattribute:: pygit2.Remote.url
.. autoattribute:: pygit2.Remote.push_url
.. autoattribute:: pygit2.Remote.refspec_count
.. autoattribute:: pygit2.Remote.push_refspecs
.. autoattribute:: pygit2.Remote.fetch_refspecs
.. automethod:: pygit2.Remote.get_push_refspecs
.. automethod:: pygit2.Remote.get_fetch_refspecs
.. automethod:: pygit2.Remote.set_push_refspecs

View File

@ -59,6 +59,7 @@ Below there are some general attributes and methods:
.. autoattribute:: pygit2.Repository.workdir
.. autoattribute:: pygit2.Repository.is_bare
.. autoattribute:: pygit2.Repository.is_empty
.. autoattribute:: pygit2.Repository.default_signature
.. automethod:: pygit2.Repository.read
.. automethod:: pygit2.Repository.write
.. automethod:: pygit2.Repository.reset

View File

@ -8,7 +8,7 @@ Index read::
>>> index = repo.index
>>> index.read()
>>> oid = index['path/to/file'].oid # from path to object id
>>> oid = index['path/to/file'].id # from path to object id
>>> blob = repo[oid] # from object id to object
Iterate over all entries of the index::