Skip to content

Commit

Permalink
Merge branch 'buildbot-0.8.0'
Browse files Browse the repository at this point in the history
* buildbot-0.8.0:
  Git: add missing "submodules" documentation.
  Git: document 'shallow' option.
  Git: add test for shallow clones.
  Git: be shallow on an initial clone.
  • Loading branch information
Dustin J. Mitchell committed Mar 15, 2010
2 parents b52d74f + d6ec70b commit e6e1ce7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
6 changes: 6 additions & 0 deletions buildbot/broken_test/vc/test_vc.py
Expand Up @@ -3136,6 +3136,12 @@ def testCheckout(self):
d = self.do_vctest()
return d

def testCheckoutShallow(self):
self.helper.vcargs = { 'repourl': self.helper.gitrepo,
'shallow': True }
d = self.do_vctest()
return d

def testPatch(self):
self.helper.vcargs = { 'repourl': self.helper.gitrepo,
'branch': "master" }
Expand Down
17 changes: 15 additions & 2 deletions buildbot/slave/commands/vcs.py
Expand Up @@ -1026,8 +1026,21 @@ def _didInit(self, res):
return self.doVCUpdate()

def doVCFull(self):
os.makedirs(self._fullSrcdir())
return self._dovccmd(['init'], self._didInit)
# If they didn't ask for a specific revision, we can get away with a
# shallow clone.
if not self.args.get('revision') and self.args.get('shallow'):
cmd = [self.vcexe, 'clone', '--depth', '1', self.repourl,
self._fullSrcdir()]
c = ShellCommand(self.builder, cmd, self.builder.basedir,
sendRC=False, timeout=self.timeout,
maxTime=self.maxTime, usePTY=False)
self.command = c
cmdexec = c.start()
cmdexec.addCallback(self._didInit)
return cmdexec
else:
os.makedirs(self._fullSrcdir())
return self._dovccmd(['init'], self._didInit)

def parseGotRevision(self):
command = ['rev-parse', 'HEAD']
Expand Down
5 changes: 5 additions & 0 deletions buildbot/steps/source.py
Expand Up @@ -705,6 +705,7 @@ def __init__(self, repourl,
branch="master",
submodules=False,
ignore_ignores=None,
shallow=False,
**kwargs):
"""
@type repourl: string
Expand All @@ -719,17 +720,21 @@ def __init__(self, repourl,
@param submodules: Whether or not to update (and initialize)
git submodules.
@type shallow: boolean
@param shallow: Use a shallow or clone, if possible
"""
Source.__init__(self, **kwargs)
self.addFactoryArguments(repourl=repourl,
branch=branch,
submodules=submodules,
ignore_ignores=ignore_ignores,
shallow=shallow,
)
self.args.update({'repourl': repourl,
'branch': branch,
'submodules': submodules,
'ignore_ignores': ignore_ignores,
'shallow': shallow,
})

def computeSourceRevision(self, changes):
Expand Down
8 changes: 8 additions & 0 deletions docs/cfg-buildsteps.texinfo
Expand Up @@ -860,6 +860,14 @@ branch will be used.
(optional): when purging changes, don't use .gitignore and
.git/info/exclude.

@item submodules
(optional): when initializing/updating a Git repository, this decides whether
or not buildbot should consider git submodules. Default: False.

@item shallow
(optional): instructs git to attempt shallow clones (@code{--depth 1}). If the
user/scheduler asks for a specific revision, this parameter is ignored.

@end table


Expand Down

0 comments on commit e6e1ce7

Please sign in to comment.