summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-28 18:41:35 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-10-28 18:41:35 +0100
commit685d6e651197d54e9a3e36f5adbadd4d21f4c7e5 (patch)
tree66f3aa0077bec21a593c7d4d9d6414a23d57462a
parenta519942a295cc39af4eebb7ba74b184decae13fb (diff)
downloadgitpython-685d6e651197d54e9a3e36f5adbadd4d21f4c7e5.tar.gz
Added repo.refs for completeness (as remote.refs is there as well and quite nice to use)
-rw-r--r--lib/git/repo.py10
-rw-r--r--test/git/test_refs.py6
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/git/repo.py b/lib/git/repo.py
index 569d6f1b..2383eb2a 100644
--- a/lib/git/repo.py
+++ b/lib/git/repo.py
@@ -143,6 +143,16 @@ class Repo(object):
``git.IterableList(Head, ...)``
"""
return Head.list_items(self)
+
+ @property
+ def refs(self):
+ """
+ A list of Reference objects representing tags, heads and remote references.
+
+ Returns
+ IterableList(Reference, ...)
+ """
+ return Reference.list_items(self)
# alias heads
branches = heads
diff --git a/test/git/test_refs.py b/test/git/test_refs.py
index 979165ef..0a70af1f 100644
--- a/test/git/test_refs.py
+++ b/test/git/test_refs.py
@@ -68,6 +68,12 @@ class TestRefs(TestBase):
assert prev_object is not cur_object # but are different instances
# END for each head
+ def test_refs(self):
+ types_found = set()
+ for ref in self.rorepo.refs:
+ types_found.add(type(ref))
+ assert len(types_found) == 3
+
@with_rw_repo('0.1.6')
def test_head_reset(self, rw_repo):
cur_head = rw_repo.head