Ticket #277: buildbot-hg-pull-command.patch
| File buildbot-hg-pull-command.patch, 2.6 kB (added by bsmedberg, 4 months ago) |
|---|
-
buildbot/slave/commands.py
old new 2092 2092 def sourcedirIsUpdateable(self): 2093 2093 if os.path.exists(os.path.join(self.builder.basedir, 2094 2094 self.srcdir, ".buildbot-patched")): 2095 2095 return False 2096 # like Darcs, to check out a specific (old) revision, we have to do a2097 # full checkout. TODO: I think 'hg pull' plus 'hg update' might work2098 if self.revision:2099 return False2100 2096 return os.path.isdir(os.path.join(self.builder.basedir, 2101 2097 self.srcdir, ".hg")) 2102 2098 2103 2099 def doVCUpdate(self): 2104 2100 d = os.path.join(self.builder.basedir, self.srcdir) 2105 command = [self.vcexe, 'pull', '--update', '--verbose'] 2106 if self.args['revision']: 2107 command.extend(['--rev', self.args['revision']]) 2101 command = [self.vcexe, 'pull', '--verbose'] 2108 2102 c = ShellCommand(self.builder, command, d, 2109 2103 sendRC=False, timeout=self.timeout, 2110 2104 keepStdout=True) 2111 2105 self.command = c … … 2113 2107 d.addCallback(self._handleEmptyUpdate) 2114 2108 return d 2115 2109 2116 2110 def _handleEmptyUpdate(self, res): 2111 if res == 0: 2112 return self._doUpdate() 2113 2117 2114 if type(res) is int and res == 1: 2118 2115 if self.command.stdout.find("no changes found") != -1: 2119 2116 # 'hg pull', when it doesn't have anything to do, exits with 2120 2117 # rc=1, and there appears to be no way to shut this off. It 2121 2118 # emits a distinctive message to stdout, though. So catch 2122 2119 # this and pretend that it completed successfully. 2123 return 02120 return self._doUpdate() 2124 2121 return res 2125 2122 2123 def _doUpdate(self): 2124 dir = os.path.join(self.builder.basedir, self.srcdir) 2125 # When cloning a tree without a specified revision, you get the tip of the default 2126 # branch. Do the same thing when updating a tree without a specified revision. 2127 if self.args['revision']: 2128 rev = self.args['revision'] 2129 else: 2130 rev = 'default' 2131 command = [self.vcexe, 'update', '-C', '--rev', rev] 2132 c = ShellCommand(self.builder, command, dir, 2133 sendRC=False, timeout=self.timeout, 2134 keepStdout=True) 2135 return c.start() 2136 2126 2137 def doVCFull(self): 2127 2138 d = os.path.join(self.builder.basedir, self.srcdir) 2128 2139 command = [self.vcexe, 'clone'] 2129 2140 if self.args['revision']:
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)