From 1cc112c32f3706f2caa24262bfd6082641eab059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 25 Jan 2014 04:22:54 +0100 Subject: [PATCH] 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. --- docs/merge.rst | 2 +- docs/objects.rst | 10 ++++++++-- docs/oid.rst | 5 +++-- docs/recipes/git-log.rst | 2 +- docs/remotes.rst | 3 +++ docs/repository.rst | 1 + docs/working-copy.rst | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/docs/merge.rst b/docs/merge.rst index 82c243a..4d98590 100644 --- a/docs/merge.rst +++ b/docs/merge.rst @@ -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 diff --git a/docs/objects.rst b/docs/objects.rst index 377829e..4c868c9 100644 --- a/docs/objects.rst +++ b/docs/objects.rst @@ -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 - >>> blob = repo[entry.oid] # Get the object the entry points to + >>> blob = repo[entry.id] # Get the object the entry points to >>> blob @@ -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 diff --git a/docs/oid.rst b/docs/oid.rst index 1ffc08c..c01e1af 100644 --- a/docs/oid.rst +++ b/docs/oid.rst @@ -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 diff --git a/docs/recipes/git-log.rst b/docs/recipes/git-log.rst index b234e0f..df645a6 100644 --- a/docs/recipes/git-log.rst +++ b/docs/recipes/git-log.rst @@ -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 ---------------------------------------------------------------------- diff --git a/docs/remotes.rst b/docs/remotes.rst index 9a9d7bf..089ab4a 100644 --- a/docs/remotes.rst +++ b/docs/remotes.rst @@ -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 diff --git a/docs/repository.rst b/docs/repository.rst index ca08f1f..c2bd0c2 100644 --- a/docs/repository.rst +++ b/docs/repository.rst @@ -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 diff --git a/docs/working-copy.rst b/docs/working-copy.rst index bb10f71..ab8c6fe 100644 --- a/docs/working-copy.rst +++ b/docs/working-copy.rst @@ -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::