@@ -208,11 +208,13 @@ query entries by name.
208208 <git.Tree "f7eb5df2e465ab621b1db3f5714850d6732cfed2">
209209 >>> for entry in tree: do_something(entry)
210210
211- >>> contents.name
212- 'test'
213-
214- >>> contents.mode
215- '040000'
211+ >>> blob = tree[0 ][0 ]
212+ >>> blob.name
213+ 'file'
214+ >>> blob.path
215+ 'dir/file'
216+ >>> blob.abspath
217+ '/Users/mtrier/Development/git-python/dir/file'
216218
217219There is a convenience method that allows you to get a named sub-object
218220from a tree with a syntax similar to how paths are written in an unix
@@ -228,39 +230,17 @@ You can also get a tree directly from the repository if you know its name.
228230
229231 >>> repo.tree(" c1c7214dde86f76bc3e18806ac1f47c38b2b7a30" )
230232 <git.Tree "c1c7214dde86f76bc3e18806ac1f47c38b2b7a30">
233+ >>> repo.tree(' 0.1.6' )
234+ <git.Tree "6825a94104164d9f0f5632607bebd2a32a3579e5">
235+
236+ As trees only allow direct access to their direct entries, use the traverse
237+ method to obtain an iterator to access entries recursively.
231238
232- The Blob object
233- ***************
234-
235- A blob represents a file. Trees often contain blobs.
236-
237- >>> blob = tree[' urls.py' ]
238- <git.Blob "b19574431a073333ea09346eafd64e7b1908ef49">
239-
240- A blob has certain attributes.
241-
242- >>> blob.name
243- 'urls.py'
244-
245- >>> blob.mode
246- '100644'
247-
248- >>> blob.mime_type
249- 'text/x-python'
250-
251- >>> blob.size
252- 415
253-
254- You can get the data of a blob as a string.
255-
256- >>> blob.data
257- "from django.conf.urls.defaults import *\nfrom django.conf..."
258-
259- You can also get a blob directly from the repo if you know its name.
239+ >>> tree.traverse()
240+ <generator object at 0x7f6598bd65a8>
241+ >>> for entry in traverse(): do_something(entry)
260242
261- >>> repo.blob(" b19574431a073333ea09346eafd64e7b1908ef49" )
262- <git.Blob "b19574431a073333ea09346eafd64e7b1908ef49">
263-
243+
264244Handling Remotes
265245****************
266246
@@ -270,13 +250,31 @@ Obtaining Diff Information
270250Switching Branches
271251******************
272252
253+ Using git directly
254+ ******************
255+ In case you are missing functionality as it has not been wrapped, you may conveniently
256+ use the git command directly. It is owned by each repository instance.
257+
258+ >>> git = repo.git
259+ >>> git.checkout(' head' , b = " my_new_branch" ) # default command
260+ >>> git.for_each_ref() # '-' becomes '_' when calling it
261+
262+ The return value will by default be a string of the standard output channel produced
263+ by the command.
264+
265+ Keyword arguments translate to short and long keyword arguments on the commandline.
266+ The special notion `git.command(flag=True) `_ will create a flag without value like
267+ ``command --flag ``.
268+
269+ If ``None `` is found in the arguments, it will be dropped silently. Lists and tuples
270+ passed as arguments will be unpacked to individual arguments. Objects are converted
271+ to strings using the str(...) function.
272+
273273What Else?
274274**********
275275
276- There is more stuff in there, like the ability to tar or gzip repos, stats,
277- log, blame, and probably a few other things. Additionally calls to the git
278- instance are handled through a ``__getattr__ `` construct, which makes
279- available any git commands directly, with a nice conversion of Python dicts
280- to command line parameters.
276+ There is more stuff in there, like the ability to archive repositories, get stats
277+ and logs, blame, and probably a few other things.
278+
279+ Check the unit tests for an in-depth introduction on how each function is supposed to be used.
281280
282- Check the unit tests, they're pretty exhaustive.
0 commit comments