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:
parent
5410128187
commit
1cc112c32f
@ -22,7 +22,7 @@ merge with the default ones defined in GIT_MERGE_OPTS_INIT libgit2 constant.
|
|||||||
Example::
|
Example::
|
||||||
|
|
||||||
>>> branch_head_hex = '5ebeeebb320790caf276b9fc8b24546d63316533'
|
>>> 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)
|
>>> merge_result = self.repo.merge(branch_oid)
|
||||||
|
|
||||||
The MergeResult object
|
The MergeResult object
|
||||||
|
@ -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:
|
This is the common interface for all Git objects:
|
||||||
|
|
||||||
|
.. autoattribute:: pygit2.Object.id
|
||||||
.. autoattribute:: pygit2.Object.oid
|
.. autoattribute:: pygit2.Object.oid
|
||||||
.. autoattribute:: pygit2.Object.hex
|
.. autoattribute:: pygit2.Object.hex
|
||||||
.. autoattribute:: pygit2.Object.type
|
.. autoattribute:: pygit2.Object.type
|
||||||
@ -170,10 +171,13 @@ Tree entries
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
.. autoattribute:: pygit2.TreeEntry.name
|
.. autoattribute:: pygit2.TreeEntry.name
|
||||||
|
.. autoattribute:: pygit2.TreeEntry.id
|
||||||
.. autoattribute:: pygit2.TreeEntry.oid
|
.. autoattribute:: pygit2.TreeEntry.oid
|
||||||
.. autoattribute:: pygit2.TreeEntry.hex
|
.. autoattribute:: pygit2.TreeEntry.hex
|
||||||
.. autoattribute:: pygit2.TreeEntry.filemode
|
.. autoattribute:: pygit2.TreeEntry.filemode
|
||||||
|
|
||||||
|
:class:`TreeEntry` supports comparison against other tree entries.
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
>>> tree = commit.tree
|
>>> tree = commit.tree
|
||||||
@ -181,7 +185,7 @@ Example::
|
|||||||
6
|
6
|
||||||
|
|
||||||
>>> for entry in tree: # Iteration
|
>>> for entry in tree: # Iteration
|
||||||
... print(entry.hex, entry.name)
|
... print(entry.id, entry.name)
|
||||||
...
|
...
|
||||||
7151ca7cd3e59f3eab19c485cfbf3cb30928d7fa .gitignore
|
7151ca7cd3e59f3eab19c485cfbf3cb30928d7fa .gitignore
|
||||||
c36f4cf1e38ec1bb9d9ad146ed572b89ecfc9f18 COPYING
|
c36f4cf1e38ec1bb9d9ad146ed572b89ecfc9f18 COPYING
|
||||||
@ -194,7 +198,7 @@ Example::
|
|||||||
>>> entry
|
>>> entry
|
||||||
<pygit2.TreeEntry object at 0xcc10f0>
|
<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
|
>>> blob
|
||||||
<pygit2.Blob object at 0xcc12d0>
|
<pygit2.Blob object at 0xcc12d0>
|
||||||
|
|
||||||
@ -221,7 +225,9 @@ committer and others.
|
|||||||
.. autoattribute:: pygit2.Commit.message_encoding
|
.. autoattribute:: pygit2.Commit.message_encoding
|
||||||
.. autoattribute:: pygit2.Commit.raw_message
|
.. autoattribute:: pygit2.Commit.raw_message
|
||||||
.. autoattribute:: pygit2.Commit.tree
|
.. autoattribute:: pygit2.Commit.tree
|
||||||
|
.. autoattribute:: pygit2.Commit.tree_id
|
||||||
.. autoattribute:: pygit2.Commit.parents
|
.. autoattribute:: pygit2.Commit.parents
|
||||||
|
.. autoattribute:: pygit2.Commit.parent_ids
|
||||||
.. autoattribute:: pygit2.Commit.commit_time
|
.. autoattribute:: pygit2.Commit.commit_time
|
||||||
.. autoattribute:: pygit2.Commit.commit_time_offset
|
.. autoattribute:: pygit2.Commit.commit_time_offset
|
||||||
|
|
||||||
|
@ -61,8 +61,9 @@ The Oid type
|
|||||||
>>> raw = unhexlify("cff3ceaefc955f0dbe1957017db181bc49913781")
|
>>> raw = unhexlify("cff3ceaefc955f0dbe1957017db181bc49913781")
|
||||||
>>> oid2 = Oid(raw=raw)
|
>>> oid2 = Oid(raw=raw)
|
||||||
|
|
||||||
An the other way around, from an Oid object we can get the hexadecimal and raw
|
And the other way around, from an Oid object we can get the hexadecimal and raw
|
||||||
forms.
|
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.hex
|
||||||
.. autoattribute:: pygit2.Oid.raw
|
.. autoattribute:: pygit2.Oid.raw
|
||||||
|
@ -31,7 +31,7 @@ Traverse commit history
|
|||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
>>> last = repo[repo.head.target]
|
>>> 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
|
>>> print(commit.message) # or some other operation
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
@ -12,7 +12,10 @@ The Remote type
|
|||||||
|
|
||||||
.. autoattribute:: pygit2.Remote.name
|
.. autoattribute:: pygit2.Remote.name
|
||||||
.. autoattribute:: pygit2.Remote.url
|
.. autoattribute:: pygit2.Remote.url
|
||||||
|
.. autoattribute:: pygit2.Remote.push_url
|
||||||
.. autoattribute:: pygit2.Remote.refspec_count
|
.. 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_push_refspecs
|
||||||
.. automethod:: pygit2.Remote.get_fetch_refspecs
|
.. automethod:: pygit2.Remote.get_fetch_refspecs
|
||||||
.. automethod:: pygit2.Remote.set_push_refspecs
|
.. automethod:: pygit2.Remote.set_push_refspecs
|
||||||
|
@ -59,6 +59,7 @@ Below there are some general attributes and methods:
|
|||||||
.. autoattribute:: pygit2.Repository.workdir
|
.. autoattribute:: pygit2.Repository.workdir
|
||||||
.. autoattribute:: pygit2.Repository.is_bare
|
.. autoattribute:: pygit2.Repository.is_bare
|
||||||
.. autoattribute:: pygit2.Repository.is_empty
|
.. autoattribute:: pygit2.Repository.is_empty
|
||||||
|
.. autoattribute:: pygit2.Repository.default_signature
|
||||||
.. automethod:: pygit2.Repository.read
|
.. automethod:: pygit2.Repository.read
|
||||||
.. automethod:: pygit2.Repository.write
|
.. automethod:: pygit2.Repository.write
|
||||||
.. automethod:: pygit2.Repository.reset
|
.. automethod:: pygit2.Repository.reset
|
||||||
|
@ -8,7 +8,7 @@ Index read::
|
|||||||
|
|
||||||
>>> index = repo.index
|
>>> index = repo.index
|
||||||
>>> index.read()
|
>>> 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
|
>>> blob = repo[oid] # from object id to object
|
||||||
|
|
||||||
Iterate over all entries of the index::
|
Iterate over all entries of the index::
|
||||||
|
Loading…
Reference in New Issue
Block a user