summaryrefslogtreecommitdiff
path: root/morphlib/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/git.py')
-rw-r--r--morphlib/git.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/morphlib/git.py b/morphlib/git.py
index cab551ef..fa0d590f 100644
--- a/morphlib/git.py
+++ b/morphlib/git.py
@@ -34,11 +34,17 @@ class NoModulesFileError(cliapp.AppException):
class Submodule(object):
- def __init__(self, name, url, path):
+ def __init__(self, name, url, sha1, path):
self.name = name
self.url = url
+ self.commit = sha1
self.path = path
+ def __str__(self):
+ return "{name}|{url}|{path}".format(name=self.name,
+ url=self.url,
+ path=self.path)
+
class InvalidSectionError(cliapp.AppException):
@@ -48,14 +54,6 @@ class InvalidSectionError(cliapp.AppException):
'title: [%s]' % (repo, ref, section))
-class MissingSubmoduleCommitError(cliapp.AppException):
-
- def __init__(self, repo, ref, submodule):
- Exception.__init__(self,
- '%s:%s:.gitmodules: No commit object found for '
- 'submodule "%s"' % (repo, ref, submodule))
-
-
class Submodules(object):
def __init__(self, repo, ref, runcmd_cb=cliapp.runcmd):
@@ -87,6 +85,7 @@ class Submodules(object):
raise NoModulesFileError(self.repo, self.ref)
def _validate_and_read_entries(self, parser):
+ gd = morphlib.gitdir.GitDirectory(self.repo)
for section in parser.sections():
# validate section name against the 'section "foo"' pattern
section_pattern = r'submodule "(.*)"'