Skip to content

Commit

Permalink
Merge branch 'git-inline-fetch' of https://github.com/jaredgrubb/buil…
Browse files Browse the repository at this point in the history
…dbot into pr1674
  • Loading branch information
Pierre Tardy committed May 25, 2015
2 parents db84e13 + 10155a7 commit ee4ab4c
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions master/buildbot/steps/source/git.py
Expand Up @@ -373,6 +373,7 @@ def evaluateCommand(_):
return cmd.rc
return d

@defer.inlineCallbacks
def _fetch(self, _):
command = ['fetch', '-t', self.repourl, self.branch]
# If the 'progress' option is set, tell git fetch to output
Expand All @@ -382,28 +383,21 @@ def _fetch(self, _):
if self.prog:
command.append('--progress')

d = self._dovccmd(command)
yield self._dovccmd(command)

@d.addCallback
def checkout(_):
if self.revision:
rev = self.revision
else:
rev = 'FETCH_HEAD'
command = ['reset', '--hard', rev, '--']
abandonOnFailure = not self.retryFetch and not self.clobberOnFailure
return self._dovccmd(command, abandonOnFailure)

if self.branch != 'HEAD':
@d.addCallback
def renameBranch(res):
if res != RC_SUCCESS:
return res
d = self._dovccmd(['branch', '-M', self.branch], abandonOnFailure=False)
# Ignore errors
d.addCallback(lambda _: res)
return d
return d
if self.revision:
rev = self.revision
else:
rev = 'FETCH_HEAD'
command = ['reset', '--hard', rev, '--']
abandonOnFailure = not self.retryFetch and not self.clobberOnFailure
res = yield self._dovccmd(command, abandonOnFailure)

if res == RC_SUCCESS and self.branch != 'HEAD':
# Ignore errors
yield self._dovccmd(['branch', '-M', self.branch], abandonOnFailure=False)

defer.returnValue(res)

@defer.inlineCallbacks
def _fetchOrFallback(self, _=None):
Expand Down

0 comments on commit ee4ab4c

Please sign in to comment.