Skip to content

Commit d7e59d3

Browse files
committed
added in note about how to handle date time information. Fixed up repo tests for the removal of the shared option.
1 parent 0651f09 commit d7e59d3

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

README

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,20 @@ Commit objects contain information about a specific commit.
120120
(2008, 5, 7, 5, 0, 56, 2, 128, 0)
121121

122122
>>> head.message
123-
'cleaned up a lot of test information. Fixed escaping so it works with subprocess.'
123+
'cleaned up a lot of test information. Fixed escaping so it works with
124+
subprocess.'
124125

126+
Note: date time is represented in a `struct_time`_ format. Conversion to
127+
human readable form can be accomplished with the various time module methods.
128+
129+
>>> import time
130+
>>> time.asctime(head.committed_date)
131+
'Wed May 7 05:56:02 2008'
132+
133+
>>> time.strftime("%a, %d %b %Y %H:%M", head.committed_date)
134+
'Wed, 7 May 2008 05:56'
135+
136+
.. _struct_time: http://docs.python.org/lib/module-time.html
125137

126138
You can traverse a commit's ancestry by chaining calls to ``parents``.
127139

@@ -149,9 +161,9 @@ Once you have a tree, you can get the contents.
149161
<GitPython.Tree "eaa0090ec96b054e425603480519e7cf587adfc3">,
150162
<GitPython.Blob "980e72ae16b5378009ba5dfd6772b59fe7ccd2df">]
151163

152-
This tree contains three ``Blob`` objects and one ``Tree`` object. The trees are
153-
subdirectories and the blobs are files. Trees below the root have additional
154-
attributes.
164+
This tree contains three ``Blob`` objects and one ``Tree`` object. The trees
165+
are subdirectories and the blobs are files. Trees below the root have
166+
additional attributes.
155167

156168
>>> contents = tree.contents[-2]
157169
<GitPython.Tree "e5445b9db4a9f08d5b4de4e29e61dffda2f386ba">
@@ -211,7 +223,11 @@ You can also get a blob directly from the repo if you know its name.
211223
What Else?
212224
**********
213225

214-
There is more stuff in there, like the ability to tar or gzip repos, stats, blame, and probably a few other things. Additionally calls to the git instance are handled through a ``method_missing`` construct, which makes available any git commands directly, with a nice conversion of Python dicts to command line parameters.
226+
There is more stuff in there, like the ability to tar or gzip repos, stats,
227+
log, blame, and probably a few other things. Additionally calls to the git
228+
instance are handled through a ``method_missing`` construct, which makes
229+
available any git commands directly, with a nice conversion of Python dicts
230+
to command line parameters.
215231

216232
Check the unit tests, they're pretty exhaustive.
217233

test/git/test_repo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_fork_bare(self, repo, git):
135135
self.repo.fork_bare("/foo/bar.git")
136136

137137
assert_true(git.called)
138-
assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'), {'bare': True, 'shared': False}))
138+
assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'), {'bare': True}))
139139
assert_true(repo.called)
140140

141141
@patch(Repo, '__init__')
@@ -147,7 +147,7 @@ def test_fork_bare_with_options(self, repo, git):
147147

148148
assert_true(git.called)
149149
assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'),
150-
{'bare': True, 'shared': False, 'template': '/awesome'}))
150+
{'bare': True, 'template': '/awesome'}))
151151
assert_true(repo.called)
152152

153153
@patch(Git, 'method_missing')

0 commit comments

Comments
 (0)