From 483a6043ed2cab2436009eeb7465269b7a48e65f Mon Sep 17 00:00:00 2001 From: Marcus Lindblom Date: Sun, 17 May 2009 11:19:38 +0200 Subject: [PATCH] See #446. Mercurial should clone to specific rev when in clobber and dirname-branch mode --- buildbot/slave/commands.py | 12 ++++++++++-- buildbot/steps/source.py | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/buildbot/slave/commands.py b/buildbot/slave/commands.py index 46901db1e13..7c2155c4a21 100755 --- a/buildbot/slave/commands.py +++ b/buildbot/slave/commands.py @@ -2469,7 +2469,7 @@ class Mercurial(SourceBase): """Mercurial specific VC operation. In addition to the arguments handled by SourceBase, this command reads the following keys: - ['repourl'] (required): the Cogito repository string + ['repourl'] (required): the Mercurial repository string """ header = "mercurial operation" @@ -2480,6 +2480,7 @@ def setup(self, args): self.repourl = args['repourl'] self.clobberOnBranchChange = args['clobberOnBranchChange'] self.sourcedata = "%s\n" % self.repourl + self.branchType = args['branchType'] self.stdout = "" self.stderr = "" @@ -2511,7 +2512,14 @@ def _handleEmptyUpdate(self, res): def doVCFull(self): d = os.path.join(self.builder.basedir, self.srcdir) - command = [self.vcexe, 'clone', '--verbose', '--noupdate', self.repourl, d] + command = [self.vcexe, 'clone', '--verbose', '--noupdate'] + + # if got revision, clobbering and in dirname, only clone to specific revision + # (otherwise, do full clone to re-use .hg dir for subsequent byuilds) + if self.args.get('revision') and self.mode == 'clobber' and self.branchType == 'dirname': + command.extend(['--rev', self.args.get('revision')]) + command.extend([self.repourl, d]) + c = ShellCommand(self.builder, command, self.builder.basedir, sendRC=False, timeout=self.timeout, usePTY=False) self.command = c diff --git a/buildbot/steps/source.py b/buildbot/steps/source.py index 07bb50e30a2..96e0fb9a839 100644 --- a/buildbot/steps/source.py +++ b/buildbot/steps/source.py @@ -957,6 +957,7 @@ def startVC(self, branch, revision, patch): self.args['revision'] = revision self.args['patch'] = patch self.args['clobberOnBranchChange'] = self.clobberOnBranchChange + self.args['branchType'] = self.branchType revstuff = [] if branch is not None and branch != self.branch: