summaryrefslogtreecommitdiff
path: root/lib/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-18 23:11:32 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-18 23:11:32 +0100
commitf1545bd9cd6953c5b39c488bf7fe179676060499 (patch)
tree8bd4b8829768fe0195d41a3aa067aa1ac7435605 /lib/git/repo/base.py
parenta1d1d2cb421f16bd277d7c4ce88398ff0f5afb29 (diff)
parent7cf2d5fcf0a3db793678dd6ba9fc1c24d4eeb36a (diff)
downloadgitpython-f1545bd9cd6953c5b39c488bf7fe179676060499.tar.gz
Merge branch 'submodule'
Diffstat (limited to 'lib/git/repo/base.py')
-rw-r--r--lib/git/repo/base.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/lib/git/repo/base.py b/lib/git/repo/base.py
index 790b1283..aa00d028 100644
--- a/lib/git/repo/base.py
+++ b/lib/git/repo/base.py
@@ -6,7 +6,6 @@
from git.exc import InvalidGitRepositoryError, NoSuchPathError
from git.cmd import Git
-from git.objects import Actor
from git.refs import *
from git.index import IndexFile
from git.objects import *
@@ -222,6 +221,44 @@ class Repo(object):
""":return: Remote with the specified name
:raise ValueError: if no remote with such a name exists"""
return Remote(self, name)
+
+ #{ Submodules
+
+ @property
+ def submodules(self):
+ """:return: git.IterableList(Submodule, ...) of direct submodules
+ available from the current head"""
+ return Submodule.list_items(self)
+
+ def submodule(self, name):
+ """:return: Submodule with the given name
+ :raise ValueError: If no such submodule exists"""
+ try:
+ return self.submodules[name]
+ except IndexError:
+ raise ValueError("Didn't find submodule named %r" % name)
+ # END exception handling
+
+ def create_submodule(self, *args, **kwargs):
+ """Create a new submodule
+ :note: See the documentation of Submodule.add for a description of the
+ applicable parameters
+ :return: created submodules"""
+ return Submodule.add(self, *args, **kwargs)
+
+ def iter_submodules(self, *args, **kwargs):
+ """An iterator yielding Submodule instances, see Traversable interface
+ for a description of args and kwargs
+ :return: Iterator"""
+ return RootModule(self).traverse(*args, **kwargs)
+
+ def submodule_update(self, *args, **kwargs):
+ """Update the submodules, keeping the repository consistent as it will
+ take the previous state into consideration. For more information, please
+ see the documentation of RootModule.update"""
+ return RootModule(self).update(*args, **kwargs)
+
+ #}END submodules
@property
def tags(self):