Small improvements of the documentation (commit and iterable trees)
This commit is contained in:
14
README.md
14
README.md
@@ -49,7 +49,7 @@ Index read:
|
|||||||
|
|
||||||
Iterate over all entries of the index:
|
Iterate over all entries of the index:
|
||||||
|
|
||||||
>>> for i in range(0, len(index)):
|
>>> for i in xrange(len(index)):
|
||||||
... entry = index[i]
|
... entry = index[i]
|
||||||
... print entry.path, entry.sha
|
... print entry.path, entry.sha
|
||||||
|
|
||||||
@@ -65,6 +65,18 @@ Revision walking:
|
|||||||
>>> for commit in repo.walk(sha, GIT_SORT_TIME):
|
>>> for commit in repo.walk(sha, GIT_SORT_TIME):
|
||||||
... print commit.sha
|
... print commit.sha
|
||||||
|
|
||||||
|
Read commit information:
|
||||||
|
|
||||||
|
>>> master_ref = repo.lookup_reference("refs/heads/master") # Getting the Reference object
|
||||||
|
>>> commit = repo[master_ref.sha]
|
||||||
|
>>> [name, email, timestamp, tz_offset] = commit.author # Read the commit authored infos
|
||||||
|
>>> tree = commit.tree # Access the tree of the commit
|
||||||
|
|
||||||
|
Iterate over all entries of the tree:
|
||||||
|
|
||||||
|
>>> for entry in tree:
|
||||||
|
... print entry.name, entry.sha, entry.attributes
|
||||||
|
|
||||||
|
|
||||||
CONTRIBUTING
|
CONTRIBUTING
|
||||||
==============
|
==============
|
||||||
|
Reference in New Issue
Block a user