Ticket #277: buildbot-bug277.patch
| File buildbot-bug277.patch, 3.3 kB (added by bsmedberg, 4 months ago) |
|---|
-
buildbot/slave/commands.py
old new 2204 2204 def setup(self, args): 2205 2205 SourceBase.setup(self, args) 2206 2206 self.vcexe = getCommand("hg") 2207 2207 self.repourl = args['repourl'] 2208 2208 self.sourcedata = "%s\n" % self.repourl 2209 2209 self.stdout = "" 2210 2210 self.stderr = "" 2211 2211 2212 2212 def sourcedirIsUpdateable(self): 2213 2213 if os.path.exists(os.path.join(self.builder.basedir, 2214 2214 self.srcdir, ".buildbot-patched")): 2215 2215 return False 2216 # like Darcs, to check out a specific (old) revision, we have to do a2217 # full checkout. TODO: I think 'hg pull' plus 'hg update' might work2218 if self.revision:2219 return False2220 2216 return os.path.isdir(os.path.join(self.builder.basedir, 2221 2217 self.srcdir, ".hg")) 2222 2218 2223 2219 def doVCUpdate(self): 2224 2220 d = os.path.join(self.builder.basedir, self.srcdir) 2225 command = [self.vcexe, 'pull', '--update', '--verbose'] 2226 if self.args['revision']: 2227 command.extend(['--rev', self.args['revision']]) 2221 command = [self.vcexe, 'pull', '--verbose'] 2228 2222 c = ShellCommand(self.builder, command, d, 2229 2223 sendRC=False, timeout=self.timeout, 2230 2224 keepStdout=True) 2231 2225 self.command = c 2232 2226 d = c.start() 2233 2227 d.addCallback(self._handleEmptyUpdate) 2234 2228 return d 2235 2229 2236 2230 def _handleEmptyUpdate(self, res): 2231 if res == 0: 2232 return self._doUpdate() 2233 2237 2234 if type(res) is int and res == 1: 2238 2235 if self.command.stdout.find("no changes found") != -1: 2239 2236 # 'hg pull', when it doesn't have anything to do, exits with 2240 2237 # rc=1, and there appears to be no way to shut this off. It 2241 2238 # emits a distinctive message to stdout, though. So catch 2242 2239 # this and pretend that it completed successfully. 2243 return 02240 return self._doUpdate() 2244 2241 return res 2245 2242 2243 def _doUpdate(self): 2244 dir = os.path.join(self.builder.basedir, self.srcdir) 2245 # When cloning a tree without a specified revision, you get the tip 2246 # of the default branch. Do the same thing when updating without 2247 # a specified revision. 2248 if self.args['revision']: 2249 rev = self.args['revision'] 2250 else: 2251 rev = 'default' 2252 command = [self.vcexe, 'update', '-C', '--rev', rev] 2253 c = ShellCommand(self.builder, command, dir, 2254 sendRC=False, timeout=self.timeout, 2255 keepStdout=True) 2256 return c.start() 2257 2246 2258 def doVCFull(self): 2247 2259 newdir = os.path.join(self.builder.basedir, self.srcdir) 2248 2260 command = [self.vcexe, 'clone'] 2249 2261 if self.args['revision']: 2250 2262 command.extend(['--rev', self.args['revision']]) 2251 2263 command.extend([self.repourl, newdir]) 2252 2264 c = ShellCommand(self.builder, command, self.builder.basedir, 2253 2265 sendRC=False, keepStdout=True, keepStderr=True, 2254 2266 timeout=self.timeout) 2255 2267 self.command = c 2256 2268 d = c.start() 2257 2269 d.addCallback(self._maybeFallback, c)
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)