[Buildbot-commits] buildbot/contrib hg_buildbot.py,1.1,1.2

Brian Warner warner at users.sourceforge.net
Mon Jul 2 09:23:12 UTC 2007


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

Modified Files:
	hg_buildbot.py 
Log Message:
[project @ hg_buildbot.py: patch from Frederic Leroy to make it work better]

Original author: warner at lothar.com
Date: 2007-07-02 09:22:27+00:00

Index: hg_buildbot.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/contrib/hg_buildbot.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- hg_buildbot.py	21 May 2006 19:07:27 -0000	1.1
+++ hg_buildbot.py	2 Jul 2007 09:23:10 -0000	1.2
@@ -22,25 +22,14 @@
 
 # TODO: consider doing 'import mercurial.hg' and extract this information
 # using the native python
-out = commands.getoutput("hg -v log -r %s" % CHANGESET_ID)
-# TODO: or maybe use --template instead of trying hard to parse everything
-#out = commands.getoutput("hg --template SOMETHING log -r %s" % CHANGESET_ID)
+out = commands.getoutput("hg log -r %s --template '{author}\n{files}\n{desc}'" % CHANGESET_ID)
 
 s = StringIO(out)
-while True:
-    line = s.readline()
-    if not line:
-        break
-    if line.startswith("user:"):
-        user = line[line.find(":")+1:].strip()
-    elif line.startswith("files:"):
-        files = line[line.find(":")+1:].strip().split()
-    elif line.startswith("description:"):
-        comments = "".join(s.readlines())
-        if comments[-1] == "\n":
-            # this removes the additional newline that hg emits
-            comments = comments[:-1]
-        break
+user = s.readline().strip()
+# NOTE: this fail when filenames contain spaces. I cannot find a way to get
+# hg to use some other filename separator.
+files = s.readline().strip().split()
+comments = "".join(s.readlines())
 
 change = {
     'master': MASTER,
@@ -53,5 +42,5 @@
     'files': files,
     }
 
-runner.sendchange(c, True)
+runner.sendchange(change, True)
 





More information about the Commits mailing list