[Buildbot-commits] buildbot/buildbot/changes svnpoller.py,1.8,1.9

Brian Warner warner at users.sourceforge.net
Tue May 27 00:52:15 UTC 2008


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

Modified Files:
	svnpoller.py 
Log Message:
[project @ #261:buildbot_branch_deletions.diff]
Patch by Neil Hemingway <neil.hemingway at googlemail.com> that has
svnpoller checking whether the change reported by SVN is a branch
deletion. If it is, a buildbot Change is not created.

Original author: dustin at v.igoro.us
Date: 2008-05-16 20:45:12+00:00

Index: svnpoller.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/changes/svnpoller.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- svnpoller.py	29 Apr 2008 16:15:36 -0000	1.8
+++ svnpoller.py	27 May 2008 00:52:13 -0000	1.9
@@ -402,6 +402,7 @@
             branches = {}
             pathlist = el.getElementsByTagName("paths")[0]
             for p in pathlist.getElementsByTagName("path"):
+                action = p.getAttribute("action")
                 path = "".join([t.data for t in p.childNodes])
                 # the rest of buildbot is certaily not yet ready to handle
                 # unicode filenames, because they get put in RemoteCommands
@@ -411,21 +412,32 @@
                 if path.startswith("/"):
                     path = path[1:]
                 where = self._transform_path(path)
+
                 # if 'where' is None, the file was outside any project that
                 # we care about and we should ignore it
                 if where:
                     branch, filename = where
                     if not branch in branches:
-                        branches[branch] = []
-                    branches[branch].append(filename)
+                        branches[branch] = { 'files': []}
+                    branches[branch]['files'].append(filename)
 
-            for branch in branches:
-                c = Change(who=author,
-                           files=branches[branch],
-                           comments=comments,
-                           revision=revision,
-                           branch=branch)
-                changes.append(c)
+                    if not branches[branch].has_key('action'):
+                        branches[branch]['action'] = action
+
+            for branch in branches.keys():
+                action = branches[branch]['action']
+                files  = branches[branch]['files']
+                number_of_files_changed = len(files)
+
+                if action == u'D' and number_of_files_changed == 1 and files[0] == '':
+                    log.msg("Ignoring deletion of branch '%s'" % branch)
+                else:
+                    c = Change(who=author,
+                               files=files,
+                               comments=comments,
+                               revision=revision,
+                               branch=branch)
+                    changes.append(c)
 
         return changes
 





More information about the Commits mailing list