summaryrefslogtreecommitdiff
path: root/gbp/git/repository.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-27 08:36:29 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-30 18:28:15 +0300
commit1ff2be668d6650103633566f86bd2e297d84c4fc (patch)
tree5e97bd58f10af48b6b2adfc15dbe02f4d2015185 /gbp/git/repository.py
parent64352000dd27733e961b2dce6fb511636a5b5073 (diff)
downloadgit-buildpackage-1ff2be668d6650103633566f86bd2e297d84c4fc.tar.gz
git-buildpackage-1ff2be668d6650103633566f86bd2e297d84c4fc.tar.bz2
git-buildpackage-1ff2be668d6650103633566f86bd2e297d84c4fc.zip
GitRepository/has_submodules: add treeish argument
For defining a Git treeish which to look into, instead of the current working copy. Change-Id: I27abd99f0416bd4300953d3c1bae2d99de3ab6c0 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/git/repository.py')
-rw-r--r--gbp/git/repository.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index cd779152..6b21c252 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1879,18 +1879,23 @@ class GitRepository(object):
#{ Submodules
- def has_submodules(self):
+ def has_submodules(self, treeish=None):
"""
Does the repo have any submodules?
+ @param treeish: look into treeish
+ @type treeish: C{str}
@return: C{True} if the repository has any submodules, C{False}
otherwise
@rtype: C{bool}
"""
- if os.path.exists(os.path.join(self.path, '.gitmodules')):
+ if treeish:
+ try:
+ self.show('%s:.gitmodules' % treeish)
+ except GitRepositoryError:
+ return False
return True
- else:
- return False
+ return os.path.exists(os.path.join(self.path, '.gitmodules'))
def add_submodule(self, repo_path):