Skip to content

Commit

Permalink
Git._fetch: move to defer.inlineCallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Grubb committed May 24, 2015
1 parent 5b53269 commit 10155a7
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 10155a7

Please sign in to comment.