[Buildbot-devel] Git source picking wrong branch

Sean Cross sean at chumby.com
Thu Jul 28 23:07:26 UTC 2011

I'm experiencing a problem where source.Git is grabbing the wrong branch when a build is triggered from GitPoller.

My particular factory has four Git sources.  Three have "branch" set to "master", and one has "branch" set to "org.openembedded.dev".  When I trigger a build using the web interface, "branch" is set to None, and everything works. When GitPoller detects a change, it seems to set build's "branch" property to the branch that changed, usually "master".

Naturally, this causes builds triggered by GitPoller to fail as my openembedded tree has no "master" branch.

I've applied this patch, but I don't understand why it works, or what the correct solution is.  How can I make it so that builds triggered from GitPoller don't set the "branch" value, or so the Git source uses the correct branch?

diff -ur buildbot-0.8.4p2-stock/buildbot/steps/source.py buildbot-0.8.4p2/buildbot/steps/source.py
--- buildbot-0.8.4p2-stock/buildbot/steps/source.py	2011-07-17 12:49:06.000000000 +0800
+++ buildbot-0.8.4p2/buildbot/steps/source.py	2011-07-29 06:49:53.000000000 +0800
@@ -228,7 +228,7 @@
         # what source stamp would this build like to use?
         s = self.build.getSourceStamp()
         # if branch is None, then use the Step's "default" branch
-        branch = s.branch or self.branch
+        branch = self.branch or s.branch
         # if revision is None, use the latest sources (-rHEAD)
         revision = s.revision
         if not revision and not self.alwaysUseLatest:

More information about the devel mailing list