Skip to content

Commit

Permalink
Avoid git fetches by optimistically trying requested revisions.
Browse files Browse the repository at this point in the history
If we have the necessary objects already to perform a build, don't
bother trying to contact what is most likely a central resource to
perform this build.

In my case, *most* of my builds unnecessarily contact github to
perform a fetch that does not bring down new objects.
  • Loading branch information
dustin committed Sep 7, 2009
1 parent f5761d0 commit fabad24
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion buildbot/slave/commands.py
Expand Up @@ -2127,12 +2127,26 @@ def doVCUpdate(self):
command = ['clean', '-f', '-d', '-x']
return self._dovccmd(command, self._didClean)

def _didClean(self, dummy):
def _doFetch(self, dummy):
command = ['fetch', '-t', self.repourl, self.branch]
self.sendStatus({"header": "fetching branch %s from %s\n"
% (self.branch, self.repourl)})
return self._dovccmd(command, self._didFetch)

def _didClean(self, dummy):
# After a clean, try to use the given revision if we have one.
if self.revision:
# We know what revision we want. See if we have it.
d = self._dovccmd(['reset', '--hard', self.revision],
self._initSubmodules)
# If we are unable to reset to the specified version, we
# must do a fetch first and retry.
d.addErrback(self._doFetch)
return d
else:
# No known revision, go grab the latest.
return self._doFetch(None)

def _didInit(self, res):
return self.doVCUpdate()

Expand Down

0 comments on commit fabad24

Please sign in to comment.