From 60e1562cd1081198c43456fe1118b9086f755714 Mon Sep 17 00:00:00 2001 From: Julien Miotte Date: Thu, 28 Jul 2011 11:35:05 +0200 Subject: [PATCH] Adding an example in the documentation for reading the status. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 37c2d0b..f24f4cf 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,14 @@ Index read: >>> sha = index['path/to/file'].sha # from path to sha >>> blob = repo[sha] # from sha to blob +Inspect the status of the repository: + + >>> from pygit2 import GIT_STATUS_CURRENT + >>> status = repo.status() + >>> for filepath, flags in status.items(): + ... if flags != GIT_STATUS_CURRENT: + ... print "Filepath %s isn't clean" % filepath + Iterate over all entries of the index: >>> for entry in index: