[Buildbot-commits] buildbot/buildbot/scripts tryclient.py,1.5,1.6

Brian Warner warner at users.sourceforge.net
Tue Aug 16 00:23:54 UTC 2005


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

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

implement 'try' for CVS (but it doesn't work on non-trunk)

	* buildbot/scripts/tryclient.py (CVSExtractor): implement 'try'
	for CVS trees. It doesn't work for non-trunk branches,
	unfortunately.
	* buildbot/test/test_vc.py (CVS.testTry): test it, but skip the
	branch test

	* Makefile: make it easier to test against python2.2

--This line, and those below, will be ignored--
Files to commit:
   <can't compute list>

This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!


Index: tryclient.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scripts/tryclient.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- tryclient.py	15 Aug 2005 18:05:05 -0000	1.5
+++ tryclient.py	16 Aug 2005 00:23:52 -0000	1.6
@@ -1,6 +1,6 @@
 # -*- test-case-name: buildbot.test.test_scheduler,buildbot.test.test_vc -*-
 
-import os, re
+import os, re, time
 from twisted.internet import utils, protocol, defer, reactor
 from twisted.spread import pb
 from twisted.cred import credentials
@@ -8,6 +8,7 @@
 
 from buildbot.sourcestamp import SourceStamp
 from buildbot.scripts import runner
+from buildbot.util import now
 
 class SourceStampExtractor:
 
@@ -31,6 +32,31 @@
         ss = SourceStamp(self.branch, self.baserev, self.patch)
         return ss
 
+class CVSExtractor(SourceStampExtractor):
+    patchlevel = 0
+    def getBaseRevision(self):
+        # this depends upon our local clock and the repository's clock pretty
+        # in reasonable sync with each other
+        self.baserev = time.strftime("%Y-%m-%d %H:%M:%S %z",
+                                     time.gmtime(now()))
+        return defer.succeed(None)
+
+    def getPatch(self, res):
+        # the -q tells CVS to not announce each directory as it works
+        if self.branch is not None:
+            # 'cvs diff' won't take both -r and -D at the same time (it
+            # ignores the -r). As best I can tell, there is no way to make
+            # cvs give you a diff relative to a timestamp on the non-trunk
+            # branch. A bare 'cvs diff' will tell you about the changes
+            # relative to your checked-out versions, but I know of no way to
+            # find out what those checked-out versions are.
+            raise RuntimeError("Sorry, CVS 'try' builds don't work with "
+                               "branches")
+        args = ['cvs', '-q', 'diff', '-u', '-D', self.baserev]
+        d = self.do(args)
+        d.addCallback(self.readPatch, self.patchlevel)
+        return d
+
 class SVNExtractor(SourceStampExtractor):
     patchlevel = 0
     def getBaseRevision(self):
@@ -117,9 +143,7 @@
 
 def getSourceStamp(vctype, treetop, branch=None):
     if vctype == "cvs":
-        # use time.strftime("%Y-%m-%d %H:%M:%S %z", time.gmtime()),
-        # use in a cvs diff -D command?
-        raise NotImplementedError("CVSExtractor not yet implemented")
+        e = CVSExtractor(treetop, branch)
     elif vctype == "svn":
         e = SVNExtractor(treetop, branch)
     elif vctype == "baz":





More information about the Commits mailing list