Permalink
Browse files

Avoid git fetches by optimistically trying requested revisions.

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 fabad2476cebc077d58c9293ce389d465648b019
Showing with 15 additions and 1 deletion.
  1. +15 −1 buildbot/slave/commands.py
View
@@ -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()

0 comments on commit fabad24

Please sign in to comment.