diff options
author | Michael Trier <mtrier@gmail.com> | 2008-12-20 14:32:17 -0500 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2008-12-20 14:32:17 -0500 |
commit | 5f23379c496942ea6fe898a7a823b65530c126a7 (patch) | |
tree | e30c24a0089b021cae86d1a98a9fcc8b6e3c8b79 | |
parent | e4582f805156095604fe07e71195cd9aa43d7a34 (diff) | |
download | gitpython-5f23379c496942ea6fe898a7a823b65530c126a7.tar.gz |
Corrections to the tutorial to account for the change of Tree to a dictionary protocol.
-rw-r--r-- | doc/tutorial.txt | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/doc/tutorial.txt b/doc/tutorial.txt index 9a9a6258..1b100a5e 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -114,14 +114,31 @@ the root tree of the latest commit on the master branch. Once you have a tree, you can get the contents. - >>> contents = tree.contents + >>> contents = tree.values() [<git.Blob "6a91a439ea968bf2f5ce8bb1cd8ddf5bf2cad6c7">, <git.Blob "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391">, <git.Tree "eaa0090ec96b054e425603480519e7cf587adfc3">, <git.Blob "980e72ae16b5378009ba5dfd6772b59fe7ccd2df">] -This tree contains three ``Blob`` objects and one ``Tree`` object. The trees -are subdirectories and the blobs are files. Trees below the root have +The tree is implements a dictionary protocol so it can be used and acts just +like a dictionary with some additional properties. + + >>> tree.items() + [('lib', <git.Tree "310ebc9a0904531438bdde831fd6a27c6b6be58e">), + ('LICENSE', <git.Blob "6797c1421052efe2ded9efdbb498b37aeae16415">), + ('doc', <git.Tree "a58386dd101f6eb7f33499317e5508726dfd5e4f">), + ('MANIFEST.in', <git.Blob "7da4e346bb0a682e99312c48a1f452796d3fb988">), + ('.gitignore', <git.Blob "6870991011cc8d9853a7a8a6f02061512c6a8190">), + ('test', <git.Tree "c6f6ee37d328987bc6fb47a33fed16c7886df857">), + ('VERSION', <git.Blob "9faa1b7a7339db85692f91ad4b922554624a3ef7">), + ('AUTHORS', <git.Blob "9f649ef5448f9666d78356a2f66ba07c5fb27229">), + ('README', <git.Blob "9643dcf549f34fbd09503d4c941a5d04157570fe">), + ('ez_setup.py', <git.Blob "3031ad0d119bd5010648cf8c038e2bbe21969ecb">), + ('setup.py', <git.Blob "271074302aee04eb0394a4706c74f0c2eb504746">), + ('CHANGES', <git.Blob "0d236f3d9f20d5e5db86daefe1e3ba1ce68e3a97">)] + +This tree contains three ``Blob`` objects and one ``Tree`` object. The trees +are subdirectories and the blobs are files. Trees below the root have additional attributes. >>> contents = tree["lib"] @@ -153,7 +170,7 @@ The Blob object A blob represents a file. Trees often contain blobs. - >>> blob = tree.contents[-1] + >>> blob = tree['urls.py'] <git.Blob "b19574431a073333ea09346eafd64e7b1908ef49"> A blob has certain attributes. |