[Buildbot-commits] buildbot/buildbot/slave commands.py,1.49,1.50

Brian Warner warner at users.sourceforge.net
Mon May 22 17:34:44 UTC 2006


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

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

use 'svnversion' isntead of grepping 'svn info' for got_revision

	* buildbot/slave/commands.py (SVN.parseGotRevision._parse): use
	'svnversion' instead of grepping the output of 'svn info', much
	simpler and avoids CR/LF problems on windows. Thanks to Olivier
	Bonnet for the suggestion.


Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- commands.py	20 May 2006 22:15:04 -0000	1.49
+++ commands.py	22 May 2006 17:34:42 -0000	1.50
@@ -1015,11 +1015,9 @@
     def parseGotRevision(self):
         # svn checkout operations finish with 'Checked out revision 16657.'
         # svn update operations finish the line 'At revision 16654.'
-        # But we don't use those. Instead, run 'svn info'.
-        if self.mode == "export":
-            # without the .svn metadir, svn info won't work
-            return None
-        command = [self.vcexe, "info"]
+        # But we don't use those. Instead, run 'svnversion'.
+        svnversion_command = getCommand("svnversion")
+        command = [svnversion_command]
         c = ShellCommand(self.builder, command,
                          os.path.join(self.builder.basedir, self.srcdir),
                          environ=self.env,
@@ -1028,10 +1026,16 @@
         c.usePTY = False
         d = c.start()
         def _parse(res):
-            r = re.search(r'^Revision: (\d+)$', c.stdout, re.M)
-            if r:
-                return int(r.group(1))
-            return None
+            r = c.stdout.strip()
+            got_version = None
+            try:
+                got_version = int(r)
+            except ValueError:
+                msg =("SVN.parseGotRevision unable to parse output "
+                      "of svnversion: '%s'" % r)
+                log.msg(msg)
+                self.sendStatus({'header': msg + "\n"})
+            return got_version
         d.addCallback(_parse)
         return d
 





More information about the Commits mailing list