From d7e59d3ef86beb3b3b3e53a610af122b2220841b Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Sun, 18 May 2008 16:56:55 -0400 Subject: added in note about how to handle date time information. Fixed up repo tests for the removal of the shared option. --- README | 26 +++++++++++++++++++++----- test/git/test_repo.py | 4 ++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/README b/README index d9c6f1df..fd5597c6 100644 --- a/README +++ b/README @@ -120,8 +120,20 @@ Commit objects contain information about a specific commit. (2008, 5, 7, 5, 0, 56, 2, 128, 0) >>> head.message - 'cleaned up a lot of test information. Fixed escaping so it works with subprocess.' + 'cleaned up a lot of test information. Fixed escaping so it works with + subprocess.' +Note: date time is represented in a `struct_time`_ format. Conversion to +human readable form can be accomplished with the various time module methods. + + >>> import time + >>> time.asctime(head.committed_date) + 'Wed May 7 05:56:02 2008' + + >>> time.strftime("%a, %d %b %Y %H:%M", head.committed_date) + 'Wed, 7 May 2008 05:56' + +.. _struct_time: http://docs.python.org/lib/module-time.html You can traverse a commit's ancestry by chaining calls to ``parents``. @@ -149,9 +161,9 @@ Once you have a tree, you can get the contents. , ] -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. +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.contents[-2] @@ -211,7 +223,11 @@ You can also get a blob directly from the repo if you know its name. What Else? ********** -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. +There is more stuff in there, like the ability to tar or gzip repos, stats, +log, 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. Check the unit tests, they're pretty exhaustive. diff --git a/test/git/test_repo.py b/test/git/test_repo.py index d5971e65..52f5856d 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -135,7 +135,7 @@ class TestRepo(object): self.repo.fork_bare("/foo/bar.git") assert_true(git.called) - assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'), {'bare': True, 'shared': False})) + assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'), {'bare': True})) assert_true(repo.called) @patch(Repo, '__init__') @@ -147,7 +147,7 @@ class TestRepo(object): assert_true(git.called) assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'), - {'bare': True, 'shared': False, 'template': '/awesome'})) + {'bare': True, 'template': '/awesome'})) assert_true(repo.called) @patch(Git, 'method_missing') -- cgit v1.2.1