From 341da1ae81ac82fbcb0556007404934213a4970a Mon Sep 17 00:00:00 2001 From: Vincent LEFORT Date: Fri, 25 Apr 2014 14:05:04 +0200 Subject: [PATCH] Add mode and method of git step to renderables --- master/buildbot/steps/source/git.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/master/buildbot/steps/source/git.py b/master/buildbot/steps/source/git.py index 5209d081c0a..512abebdd54 100644 --- a/master/buildbot/steps/source/git.py +++ b/master/buildbot/steps/source/git.py @@ -62,7 +62,7 @@ class Git(Source): """ Class for Git with all the smarts """ name = 'git' - renderables = ["repourl", "reference", "branch", "codebase"] + renderables = ["repourl", "reference", "branch", "codebase", "mode", "method"] def __init__(self, repourl=None, branch='HEAD', mode='incremental', method=None, reference=None, submodules=False, shallow=False, progress=False, retryFetch=False, @@ -126,16 +126,17 @@ def __init__(self, repourl=None, branch='HEAD', mode='incremental', method=None, self.supportsBranch = True self.srcdir = 'source' Source.__init__(self, **kwargs) - - if self.mode not in ['incremental', 'full']: - bbconfig.error("Git: mode must be 'incremental' or 'full'.") + if not self.repourl: bbconfig.error("Git: must provide repourl.") - if (self.mode == 'full' and - self.method not in ['clean', 'fresh', 'clobber', 'copy', None]): - bbconfig.error("Git: invalid method for mode 'full'.") - if self.shallow and (self.mode != 'full' or self.method != 'clobber'): - bbconfig.error("Git: shallow only possible with mode 'full' and method 'clobber'.") + if isinstance(self.mode, str): + if self.mode not in ['incremental', 'full']: + bbconfig.error("Git: mode must be 'incremental' or 'full'.") + if isinstance(self.method, str): + if (self.mode == 'full' and self.method not in ['clean', 'fresh', 'clobber', 'copy', None]): + bbconfig.error("Git: invalid method for mode 'full'.") + if self.shallow and (self.mode != 'full' or self.method != 'clobber'): + bbconfig.error("Git: shallow only possible with mode 'full' and method 'clobber'.") if not isinstance(self.getDescription, (bool, dict)): bbconfig.error("Git: getDescription must be a boolean or a dict.")