[Buildbot-commits] buildbot/buildbot/steps source.py,1.3,1.4
Brian Warner
warner at users.sourceforge.net
Tue Jan 23 05:50:00 UTC 2007
Update of /cvsroot/buildbot/buildbot/buildbot/steps
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1130/buildbot/steps
Modified Files:
source.py
Log Message:
[project @ add support for bzr (bazaar-ng)]
Original author: warner at lothar.com
Date: 2007-01-11 00:57:02
Index: source.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/source.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- source.py 25 Sep 2006 07:46:56 -0000 1.3
+++ source.py 23 Jan 2007 05:49:58 -0000 1.4
@@ -735,6 +735,72 @@
cmd = LoggedRemoteCommand("bazaar", self.args)
self.startCommand(cmd, warnings)
+class Bzr(Source):
+ """Check out a source tree from a bzr (Bazaar) repository at 'repourl'.
+
+ """
+
+ name = "bzr"
+
+ def __init__(self, repourl=None, baseURL=None, defaultBranch=None,
+ **kwargs):
+ """
+ @type repourl: string
+ @param repourl: the URL which points at the bzr repository. This
+ is used as the default branch. Using C{repourl} does
+ not enable builds of alternate branches: use
+ C{baseURL} to enable this. Use either C{repourl} or
+ C{baseURL}, not both.
+
+ @param baseURL: if branches are enabled, this is the base URL to
+ which a branch name will be appended. It should
+ probably end in a slash. Use exactly one of
+ C{repourl} and C{baseURL}.
+
+ @param defaultBranch: if branches are enabled, this is the branch
+ to use if the Build does not specify one
+ explicitly. It will simply be appended to
+ C{baseURL} and the result handed to the
+ 'bzr checkout pull' command.
+ """
+ self.repourl = repourl
+ self.baseURL = baseURL
+ self.branch = defaultBranch
+ Source.__init__(self, **kwargs)
+ if (not repourl and not baseURL) or (repourl and baseURL):
+ raise ValueError("you must provide exactly one of repourl and"
+ " baseURL")
+
+ def computeSourceRevision(self, changes):
+ if not changes:
+ return None
+ lastChange = max([int(c.revision) for c in changes])
+ return lastChange
+
+ def startVC(self, branch, revision, patch):
+ slavever = self.slaveVersion("bzr")
+ if not slavever:
+ m = "slave is too old, does not know about bzr"
+ raise BuildSlaveTooOldError(m)
+
+ if self.repourl:
+ assert not branch # we need baseURL= to use branches
+ self.args['repourl'] = self.repourl
+ else:
+ self.args['repourl'] = self.baseURL + branch
+ self.args['revision'] = revision
+ self.args['patch'] = patch
+
+ revstuff = []
+ if branch is not None and branch != self.branch:
+ revstuff.append("[branch]")
+ self.description.extend(revstuff)
+ self.descriptionDone.extend(revstuff)
+
+ cmd = LoggedRemoteCommand("bzr", self.args)
+ self.startCommand(cmd)
+
+
class Mercurial(Source):
"""Check out a source tree from a mercurial repository 'repourl'."""
More information about the Commits
mailing list