[Buildbot-commits] buildbot/buildbot/slave commands.py,1.37,1.38

Brian Warner warner at users.sourceforge.net
Mon Aug 15 18:05:10 UTC 2005


Update of /cvsroot/buildbot/buildbot/buildbot/slave
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26903/buildbot/slave

Modified Files:
	commands.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-287
Creator:  Brian Warner <warner at monolith.lothar.com>

rewrite test_vc, make 'try' work for Darcs

	* buildbot/scripts/tryclient.py (getSourceStamp): extract branches
	where we can (Arch), add a branch= argument to set the branch used
	when we can't
	(BazExtractor): extract the branch too
	(TlaExtractor): same
	* buildbot/scripts/runner.py (TryOptions): add --branch
	* docs/buildbot.texinfo (try): document --branch/try_branch

	* buildbot/slave/commands.py (Darcs): implement get-revision for
	Darcs, so that 'try' will work. This requires the tempfile module
	from python-2.3 .

	* buildbot/test/test_vc.py: rewrite tests, getting better coverage
	of revisions, branches, and 'try' in the process.


Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- commands.py	19 Jul 2005 23:12:00 -0000	1.37
+++ commands.py	15 Aug 2005 18:05:08 -0000	1.38
@@ -970,16 +970,20 @@
         SourceBase.setup(self, args)
         self.repourl = args['repourl']
         self.sourcedata = "%s\n" % self.repourl
+        self.revision = self.args.get('revision')
 
     def sourcedirIsUpdateable(self):
         if os.path.exists(os.path.join(self.builder.basedir,
                                        self.srcdir, ".buildbot-patched")):
             return False
+        if self.revision:
+            # checking out a specific revision requires a full 'darcs get'
+            return False
         return os.path.isdir(os.path.join(self.builder.basedir,
                                           self.srcdir, "_darcs"))
 
     def doVCUpdate(self):
-        # TODO: revision
+        assert not self.revision
         # update: possible for mode in ('copy', 'update')
         d = os.path.join(self.builder.basedir, self.srcdir)
         command = ['darcs', 'pull', '--all', '--verbose']
@@ -989,16 +993,33 @@
         return c.start()
 
     def doVCFull(self):
-        # TODO: revision
         # checkout or export
         d = self.builder.basedir
         command = ['darcs', 'get', '--verbose', '--partial',
-                   '--repo-name', self.srcdir,
-                   self.repourl]
+                   '--repo-name', self.srcdir]
+        if self.revision:
+            # write the context to a file
+            import tempfile  # requires python-2.3
+            fd,n = tempfile.mkstemp(dir=self.builder.basedir)
+            f = os.fdopen(fd, "w")
+            f.write(self.revision)
+            f.close()
+            # tell Darcs to use that context
+            command.append('--context')
+            command.append(n)
+        command.append(self.repourl)
+
         c = ShellCommand(self.builder, command, d,
                          sendRC=False, timeout=self.timeout)
         self.command = c
-        return c.start()
+        d = c.start()
+        if self.revision:
+            d.addCallback(self.removeContextFile, n)
+        return d
+
+    def removeContextFile(self, res, n):
+        os.unlink(n)
+        return res
 
 registerSlaveCommand("darcs", Darcs, cvs_ver)
 





More information about the Commits mailing list