summaryrefslogtreecommitdiff
path: root/git/objects/submodule/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/objects/submodule/util.py')
-rw-r--r--git/objects/submodule/util.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py
index 237321e2..47b45109 100644
--- a/git/objects/submodule/util.py
+++ b/git/objects/submodule/util.py
@@ -9,22 +9,27 @@ __all__ = ( 'sm_section', 'sm_name', 'mkhead', 'unbare_repo', 'find_first_remote
#{ Utilities
+
def sm_section(name):
""":return: section title used in .gitmodules configuration file"""
return 'submodule "%s"' % name
+
def sm_name(section):
""":return: name of the submodule as parsed from the section name"""
section = section.strip()
return section[11:-1]
+
def mkhead(repo, path):
""":return: New branch/head instance"""
return git.Head(repo, git.Head.to_full_path(path))
+
def unbare_repo(func):
"""Methods with this decorator raise InvalidGitRepositoryError if they
encounter a bare repository"""
+
def wrapper(self, *args, **kwargs):
if self.repo.bare:
raise InvalidGitRepositoryError("Method '%s' cannot operate on bare repositories" % func.__name__)
@@ -34,6 +39,7 @@ def unbare_repo(func):
wrapper.__name__ = func.__name__
return wrapper
+
def find_first_remote_branch(remotes, branch_name):
"""Find the remote branch matching the name of the given branch or raise InvalidGitRepositoryError"""
for remote in remotes:
@@ -51,6 +57,7 @@ def find_first_remote_branch(remotes, branch_name):
#{ Classes
class SubmoduleConfigParser(GitConfigParser):
+
"""
Catches calls to _write, and updates the .gitmodules blob in the index
with the new data, if we have written into a stream. Otherwise it will