From 5f23379c496942ea6fe898a7a823b65530c126a7 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Sat, 20 Dec 2008 14:32:17 -0500 Subject: Corrections to the tutorial to account for the change of Tree to a dictionary protocol. --- doc/tutorial.txt | 25 +++++++++++++++++++++---- 1 file 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() [, , , ] -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', ), + ('LICENSE', ), + ('doc', ), + ('MANIFEST.in', ), + ('.gitignore', ), + ('test', ), + ('VERSION', ), + ('AUTHORS', ), + ('README', ), + ('ez_setup.py', ), + ('setup.py', ), + ('CHANGES', )] + +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'] A blob has certain attributes. -- cgit v1.2.1