internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: buildbot/buildbot

Issue:
Added FilterOut class from deleted file master/buildbot/status/web/st…
…atus_json.py

This class was removed in c3e1aaede2fc02507bccb548dd26e694bf32ba6a but still in use in StatusPush



Discussion:

Resolving patch:
diff --git a/master/buildbot/libvirtbuildslave.py b/master/buildbot/libvirtbuildslave.py
--- a/master/buildbot/libvirtbuildslave.py
+++ b/master/buildbot/libvirtbuildslave.py
@@ -198,13 +198,13 @@ def _start(res):
                 return self.connection.create(self.xml)
             d = self.connection.lookupByName(self.name)
             def _really_start(res):
-                return res.create()
+                self.domain = res
+                return self.domain.create()
             d.addCallback(_really_start)
             return d
         d.addCallback(_start)
 
         def _started(res):
-            self.domain = res
             return True
         d.addCallback(_started)
 


Test patch:
Repository: buildbot/buildbot

Issue:
Fix LdapUserInfo group search for UTF-8 DNs
This is about http://trac.buildbot.net/ticket/3510#ticket



Discussion:

Resolving patch:
diff --git a/master/contrib/git_buildbot.py b/master/contrib/git_buildbot.py
--- a/master/contrib/git_buildbot.py
+++ b/master/contrib/git_buildbot.py
@@ -55,6 +55,12 @@
 
 project = None
 
+# Username portion of PB login credentials to send the changes to the master
+username = "change"
+
+# Password portion of PB login credentials to send the changes to the master
+auth = "changepw"
+
 # When converting strings to unicode, assume this encoding. 
 # (set with --encoding)
 
@@ -286,7 +292,7 @@ def process_changes():
     port = int(port)
 
     f = pb.PBClientFactory()
-    d = f.login(credentials.UsernamePassword("change", "changepw"))
+    d = f.login(credentials.UsernamePassword(username, auth))
     reactor.connectTCP(host, port, f)
 
     d.addErrback(connectFailed)
@@ -317,6 +323,15 @@ def parse_options():
                      { "encoding" : encoding })
     parser.add_option("-e", "--encoding", action="store", type="string", 
                       help=encoding_help)
+    username_help = ("Username used in PB connection auth, defaults to "
+                     "%(username)s." % { "username" : username })
+    parser.add_option("-u", "--username", action="store", type="string",
+                      help=username_help)
+    auth_help = ("Password used in PB connection auth, defaults to "
+                     "%(auth)s." % { "auth" : auth })
+    # 'a' instead of 'p' due to collisions with the project short option
+    parser.add_option("-a", "--auth", action="store", type="string",
+                      help=auth_help)
     options, args = parser.parse_args()
     return options
 
@@ -357,6 +372,12 @@ def parse_options():
     if options.project:
         project = options.project
 
+    if options.username:
+        username = options.username
+
+    if options.auth:
+        auth = options.auth
+
     if options.encoding:
         encoding = options.encoding
 


Test patch:
Repository: buildbot/buildbot

Issue:
Fix plugins
a different approach for handling transiitons



Discussion:

Resolving patch:
diff --git a/master/buildbot/status/mail.py b/master/buildbot/status/mail.py
--- a/master/buildbot/status/mail.py
+++ b/master/buildbot/status/mail.py
@@ -605,6 +605,8 @@ def buildMessage(self, name, builds, results):
                     d.addCallback(self.useLookup)
                 else:
                     d.addCallback(self.useUsers)
+        else:
+            d = defer.DeferredList(self.dl)
         d.addCallback(self._gotRecipients, self.recipients, m)
         return d
 


Test patch:
diff --git a/master/buildbot/test/unit/test_status_mail.py b/master/buildbot/test/unit/test_status_mail.py
--- a/master/buildbot/test/unit/test_status_mail.py
+++ b/master/buildbot/test/unit/test_status_mail.py
@@ -307,6 +307,7 @@ def check(_):
         return d
 
     def do_test_sendToInterestedUsers(self, lookup=None, extraRecipients=[],
+                                      sendToInterestedUsers=True,
                                       exp_called_with=None, exp_TO=None,
                                       exp_CC=None):
         from email.Message import Message
@@ -314,6 +315,7 @@ def do_test_sendToInterestedUsers(self, lookup=None, extraRecipients=[],
 
         mn = MailNotifier(fromaddr='from@example.org',
                           lookup=lookup,
+                          sendToInterestedUsers=sendToInterestedUsers,
                           extraRecipients=extraRecipients)
         mn.sendMessage = Mock()
 
@@ -409,6 +411,12 @@ def test_buildMessage_sendToInterestedUsers_extraRecipients(self):
                                                     'marla@mayhem.net'],
                                    exp_TO="tyler@mayhem.net",
                                    exp_CC="marla@mayhem.net")
+    def test_sendToInterestedUsers_False(self):
+        self.do_test_sendToInterestedUsers(
+                                   extraRecipients=["marla@mayhem.net"],
+                                   sendToInterestedUsers=False,
+                                   exp_called_with=['marla@mayhem.net'],
+                                   exp_TO="marla@mayhem.net")
 
 def create_msgdict():
     unibody = u'Unicode body with non-ascii (\u00E5\u00E4\u00F6).'
Repository: buildbot/buildbot

Issue:
Don't subclass ThreadPool.



Discussion:

Resolving patch:
diff --git a/master/contrib/googlecode_atom.py b/master/contrib/googlecode_atom.py
--- a/master/contrib/googlecode_atom.py
+++ b/master/contrib/googlecode_atom.py
@@ -23,8 +23,7 @@
 #   c['change_source'] = [ poller ]
 #
 
-from time import strptime
-from calendar import timegm
+import datetime
 from xml.dom import minidom, Node
 
 from twisted.python import log, failure
@@ -32,7 +31,8 @@
 from twisted.internet.task import LoopingCall
 from twisted.web.client import getPage
 
-from buildbot.changes import base, changes
+from buildbot.changes import base
+
 
 def googleCodePollerForProject(project, vcs, pollinterval=3600):
     return GoogleCodeAtomPoller(
@@ -140,9 +140,9 @@ def _parse_changes(self, query):
             if d["revision"] == self.lastChange:
                 break  # no more new changes
 
-            d["when"] = timegm(strptime(
+            d["when"] = datetime.datetime.strptime(
                 i.getElementsByTagName("updated")[0].firstChild.data,
-                "%Y-%m-%dT%H:%M:%SZ"))
+                "%Y-%m-%dT%H:%M:%SZ")
             d["author"] = i.getElementsByTagName(
                 "author")[0].getElementsByTagName("name")[0].firstChild.data
             # files and commit msg are separated by 2 consecutive <br/>
@@ -166,18 +166,22 @@ def _parse_changes(self, query):
         changes.reverse() # want them in chronological order
         return changes
 
+    @defer.deferredGenerator
     def _process_changes(self, query):
         change_list = self._parse_changes(query)
 
         # Skip calling addChange() if this is the first successful poll.
         if self.lastChange is not None:
             for change in change_list:
-                c = changes.Change(revision = change["revision"],
-                                   who = change["author"],
-                                   files = change["files"],
-                                   comments = change["comments"],
-                                   when = change["when"],
-                                   branch = self.branch)
-                self.parent.addChange(c, src=self.src)
+                d = self.master.addChange(author=change["author"],
+                                          revision=change["revision"],
+                                          files=change["files"],
+                                          comments=change["comments"],
+                                          when_timestamp=change["when"],
+                                          branch=self.branch,
+                                          src=self.src)
+                wfd = defer.waitForDeferred(d)
+                yield wfd
+                results = wfd.getResult()
         if change_list:
             self.lastChange = change_list[-1]["revision"]


Test patch:
Repository: buildbot/buildbot

Issue:
Fix IntParameter example
http://buildbot.net/buildbot/docs/latest/manual/cfg-schedulers.html#intparameter

The `::` doesn't work too, but I don't know how to fix it.



Discussion:

Resolving patch:
diff --git a/master/buildbot/status/words.py b/master/buildbot/status/words.py
--- a/master/buildbot/status/words.py
+++ b/master/buildbot/status/words.py
@@ -25,6 +25,7 @@
 from twisted.words.protocols import irc
 from twisted.python import log, failure
 from twisted.application import internet
+from twisted.internet import task
 
 from buildbot import interfaces, util
 from buildbot import version
@@ -816,6 +817,14 @@ def __init__(self, nickname, password, channels, status, categories,
         self.noticeOnChannel = noticeOnChannel
         self.useRevisions = useRevisions
         self.showBlameList = showBlameList
+        self._keepAliveCall = task.LoopingCall(lambda: self.ping(self.nickname))
+    def connectionMade(self):
+        irc.IRCClient.connectionMade(self)
+        self._keepAliveCall.start(60)
+    def connectionLost(self, reason):
+        if self._keepAliveCall.running:
+            self._keepAliveCall.stop()
+        irc.IRCClient.connectionLost(self, reason)
 
     def msgOrNotice(self, dest, message):
         if self.noticeOnChannel and dest[0] == '#':


Test patch:
Repository: buildbot/buildbot

Issue:
include raml files onto Buildbot distribution
@tardyp I haven't included `indent.py` in Buildbot distribution. Do we need it?



Discussion:

Resolving patch:
diff --git a/master/buildbot/status/mail.py b/master/buildbot/status/mail.py
--- a/master/buildbot/status/mail.py
+++ b/master/buildbot/status/mail.py
@@ -49,6 +49,7 @@
 VALID_EMAIL = re.compile("[a-zA-Z0-9\.\_\%\-\+]+@[a-zA-Z0-9\.\_\%\-]+.[a-zA-Z]{2,6}")
 
 ENCODING = 'utf8'
+LOG_ENCODING = 'utf-8'
 
 class Domain(util.ComparableMixin):
     implements(interfaces.IEmailLookup)
@@ -577,7 +578,10 @@ def createEmail(self, msgdict, builderName, title, results, builds=None,
                                   log.getName())
                 if ( self._shouldAttachLog(log.getName()) or
                      self._shouldAttachLog(name) ):
-                    a = MIMEText(log.getText().encode(ENCODING), 
+                    text = log.getText()
+                    if not isinstance(text, unicode):
+                        text = text.decode(LOG_ENCODING)
+                    a = MIMEText(text.encode(ENCODING),
                                  _charset=ENCODING)
                     a.add_header('Content-Disposition', "attachment",
                                  filename=name)


Test patch:
diff --git a/master/buildbot/test/unit/test_status_mail.py b/master/buildbot/test/unit/test_status_mail.py
--- a/master/buildbot/test/unit/test_status_mail.py
+++ b/master/buildbot/test/unit/test_status_mail.py
@@ -98,7 +98,9 @@ def test_createEmail_message_with_patch_and_log_containing_unicode(self):
         builds = [ FakeBuildStatus(name="build") ]
         msgdict = create_msgdict()
         patches = [ ['', u'\u00E5\u00E4\u00F6', ''] ]
-        logs = [ FakeLog(u'Unicode log with non-ascii (\u00E5\u00E4\u00F6).') ]
+        msg = u'Unicode log with non-ascii (\u00E5\u00E4\u00F6).'
+        # add msg twice: as unicode and already encoded
+        logs = [ FakeLog(msg), FakeLog(msg.encode('utf-8')) ]
         mn = MailNotifier('from@example.org', addLogs=True)
         m = mn.createEmail(msgdict, u'builder-n\u00E5me',
                            u'project-n\u00E5me', SUCCESS,
Repository: buildbot/buildbot

Issue:
Allow gerrit reporter callbacks to be deferred
This addresses http://trac.buildbot.net/ticket/3522



Discussion:

Resolving patch:
diff --git a/master/buildbot/steps/shell.py b/master/buildbot/steps/shell.py
--- a/master/buildbot/steps/shell.py
+++ b/master/buildbot/steps/shell.py
@@ -171,6 +171,11 @@ def describe(self, done=False):
             words = self.command
             if isinstance(words, (str, unicode)):
                 words = words.split()
+            try:
+                len(words)
+            except AttributeError:
+                # WithProperties and Property don't have __len__
+                return ["???"]
             if len(words) < 1:
                 return ["???"]
             if len(words) == 1:


Test patch:
diff --git a/master/buildbot/test/unit/test_steps_shell.py b/master/buildbot/test/unit/test_steps_shell.py
--- a/master/buildbot/test/unit/test_steps_shell.py
+++ b/master/buildbot/test/unit/test_steps_shell.py
@@ -23,6 +23,7 @@
 from buildbot.test.fake.remotecommand import ExpectShell, Expect
 from buildbot.test.fake.remotecommand import ExpectRemoteRef
 from buildbot import config
+from buildbot.process import properties
 
 class TestShellCommandExecution(steps.BuildStepMixin, unittest.TestCase):
 
@@ -108,6 +109,11 @@ def test_describe_custom(self):
         self.assertEqual((step.describe(), step.describe(done=True)),
                          (['echoing'], ['echoed']))
 
+    def test_describe_unrendered_WithProperties(self):
+        step = shell.ShellCommand(command=properties.WithProperties(''))
+        self.assertEqual((step.describe(), step.describe(done=True)),
+                         (['???'],)*2)
+
     @compat.usesFlushLoggedErrors
     def test_describe_fail(self):
         step = shell.ShellCommand(command=object())
Repository: buildbot/buildbot

Issue:
Use sphinxcontrib-spelling to check docs spelling
This PR:
1. Adds `spelling` target to doc's Makefile that runs `sphinxcontrib-spelling` to check spelling.
2. Adds all words that currently considered as misspelled to `spelling_wordlist.txt` dictionary.
3. Adds configuration to run spellcheck on Travis.
4. Fixes `Buildbot` project name capital letter (or add appropriate quotations/semantic formatting like `:file:`, `:py:mod:`).

During fixing `Buildbot` I noticed that `sphinxcontrib-spelling` not always points to proper place of error in the source file and misses some words. This is not good, but better than nothing.
I noticed only one false positive: it doesn't handle words in URLs if URL is not explicitly marked as URL. E.g. `sphinxcontrib-spelling` considers error here:

```
visit http://nine.buildbot.net/ site
```

which may be workarounded by adding explicit formatting to URL:

```
visit `<http://nine.buildbot.net/>`__ site
```

I suggest to merge this PR with ignored most of typos and fix those typos/formatting in separate pull requests.

I propose not to only fix typos, but also semantic formatting (`:py:mod:`, `:file:`), case sensitivity (`URL` instead of `url`) and proper project names (`AppVeyor` instead of `Appveyor`).

Also when someone will fix typos I suggest to do `git grep some-typo` to fix this typo not only in docs, but in source code/scripts.



Discussion:

Resolving patch:
diff --git a/master/buildbot/buildslave.py b/master/buildbot/buildslave.py
--- a/master/buildbot/buildslave.py
+++ b/master/buildbot/buildslave.py
@@ -460,6 +460,7 @@ def detached(self, mind):
         log.msg("BuildSlave.detached(%s)" % self.slavename)
         self.botmaster.master.status.slaveDisconnected(self.slavename)
         self.stopKeepaliveTimer()
+        self.release()
 
         # notify watchers, but do so in the next reactor iteration so that
         # any further detached() action by subclasses happens first


Test patch:
Repository: buildbot/buildbot

Issue:
Allow user to launch a try build even when there are no changes in th…
Allow user to launch a try build even when there are no changes in the local repository.



Discussion:

Resolving patch:
diff --git a/master/buildbot/steps/transfer.py b/master/buildbot/steps/transfer.py
--- a/master/buildbot/steps/transfer.py
+++ b/master/buildbot/steps/transfer.py
@@ -81,7 +81,7 @@ def remote_close(self):
         if self.mode is not None:
             os.chmod(self.destfile, self.mode)
 
-    def __del__(self):
+    def cancel(self):
         # unclean shutdown, the file is probably truncated, so delete it
         # altogether rather than deliver a corrupted file
         fp = getattr(self, "fp", None)
@@ -289,6 +289,10 @@ def start(self):
 
         self.cmd = StatusRemoteCommand(self, 'uploadFile', args)
         d = self.runCommand(self.cmd)
+        @d.addErrback
+        def cancel(res):
+            fileWriter.cancel()
+            return res
         d.addCallback(self.finished).addErrback(self.failed)
 
 
@@ -358,6 +362,10 @@ def start(self):
 
         self.cmd = StatusRemoteCommand(self, 'uploadDirectory', args)
         d = self.runCommand(self.cmd)
+        @d.addErrback
+        def cancel(res):
+            dirWriter.cancel()
+            return res
         d.addCallback(self.finished).addErrback(self.failed)
 
     def finished(self, result):


Test patch:
Repository: buildbot/buildbot

Issue:
Remove obsolete monkey patch to sqlalchemy-migrate.
The tests pass without the monkey patch now.



Discussion:

Resolving patch:
diff --git a/master/contrib/bzr_buildbot.py b/master/contrib/bzr_buildbot.py
--- a/master/contrib/bzr_buildbot.py
+++ b/master/contrib/bzr_buildbot.py
@@ -50,6 +50,10 @@
   to which you will connect (as of this writing, the same server and port to
   which slaves connect)
 
+- buildbot_auth: (optional, defaults to change:changepw) the credentials
+  expected by the change source configuration in the master. Takes the
+  "user:password" form.
+
 - buildbot_pqm: (optional, defaults to not pqm) Normally, the user that
   commits the revision is the user that is responsible for the change.  When
   run in a pqm (Patch Queue Manager, see https://launchpad.net/pqm)
@@ -309,6 +313,7 @@ def _add_change():
 HOOK_KEY = 'buildbot_on'
 SERVER_KEY = 'buildbot_server'
 PORT_KEY = 'buildbot_port'
+AUTH_KEY = 'buildbot_auth'
 DRYRUN_KEY = 'buildbot_dry_run'
 PQM_KEY = 'buildbot_pqm'
 SEND_BRANCHNAME_KEY = 'buildbot_send_branch_name'
@@ -413,8 +418,13 @@ def send_change(branch, old_revno, old_revid, new_revno, new_revid, hook):
     reactor.resolver = ThreadedResolver(reactor)
     pbcf = twisted.spread.pb.PBClientFactory()
     reactor.connectTCP(server, port, pbcf)
+    auth = config.get_user_option(AUTH_KEY)
+    if auth:
+        user, passwd = [s.strip() for s in auth.split(':', 1)]
+    else:
+        user, passwd = ('change', 'changepw')
     deferred = pbcf.login(
-        twisted.cred.credentials.UsernamePassword('change', 'changepw'))
+        twisted.cred.credentials.UsernamePassword(user, passwd))
 
     def sendChanges(remote):
         """Send changes to buildbot."""


Test patch:
Repository: buildbot/buildbot

Issue:
fix master's dependencies
- Python 2.5 is not supported any more, hence to need to handle that
- 'future' module is required (as it brings in 'builtins' module), while  it was not mentioned



Discussion:

Resolving patch:
diff --git a/master/buildbot/scripts/runner.py b/master/buildbot/scripts/runner.py
--- a/master/buildbot/scripts/runner.py
+++ b/master/buildbot/scripts/runner.py
@@ -245,6 +245,22 @@ def public_html(self, files):
                 with open(source, "rt") as i:
                     f.write(i.read())
 
+    def templates_dir(self, files):
+        template_dir = os.path.join(self.basedir, "templates")
+        if os.path.exists(template_dir):
+            if not self.quiet:
+                print "templates/ already exists: not replacing"
+            return
+        else:
+            os.mkdir(template_dir)
+        if not self.quiet:
+            print "populating templates/"
+        for target, source in files.iteritems():
+            target = os.path.join(template_dir, target)
+            with open(target, "wt") as f:
+                with open(source, "rt") as i:
+                    f.write(i.read())
+
     def create_db(self):
         from buildbot.db import connector
         from buildbot.master import BuildMaster
@@ -544,6 +560,7 @@ def createMaster(config):
     else:
         masterTAC = "".join(masterTACTemplate)
     contents = masterTAC % config
+    
     m.makeTAC(contents)
     m.sampleconfig(util.sibpath(__file__, "sample.cfg"))
     m.public_html({
@@ -552,6 +569,9 @@ def createMaster(config):
           'robots.txt' : util.sibpath(__file__, "../status/web/files/robots.txt"),
           'favicon.ico' : util.sibpath(__file__, "../status/web/files/favicon.ico"),
       })
+    m.templates_dir({
+        'README.txt' : util.sibpath(__file__,"../status/web/files/templates_readme.txt"),
+    })
     d = m.create_db()
 
     def print_status(r):


Test patch:
Repository: buildbot/buildbot

Issue:
Warn about ignored buildHorizon and logHorizion.
These aren't currently used, but they could be supported in the database. Either we should get rid of them, or open a ticket to add back support (and probably document that they aren't currently working).



Discussion:

Resolving patch:
diff --git a/master/buildbot/status/web/logs.py b/master/buildbot/status/web/logs.py
--- a/master/buildbot/status/web/logs.py
+++ b/master/buildbot/status/web/logs.py
@@ -103,6 +103,11 @@ def render_GET(self, req):
         self._setContentType(req)
         self.req = req
 
+        if (self.original.isFinished()):
+            req.setHeader("Cache-Control", "max-age=604800")
+        else:
+            req.setHeader("Cache-Control", "no-cache")
+
         if not self.asText:
             self.template = req.site.buildbot_service.templates.get_template("logs.html")                
             


Test patch:
Repository: buildbot/buildbot

Issue:
Replace D.iteritems() with future.utils.iteritems(D).
dict.iteritems() is gone in Python 3.



Discussion:

Resolving patch:
diff --git a/master/buildbot/process/build.py b/master/buildbot/process/build.py
--- a/master/buildbot/process/build.py
+++ b/master/buildbot/process/build.py
@@ -194,11 +194,11 @@ def setupSlaveBuilder(self, slavebuilder):
         buildslave_properties = slavebuilder.slave.properties
         self.getProperties().updateFromProperties(buildslave_properties)
         if slavebuilder.slave.slave_basedir:
-            self.setProperty("workdir",
+            self.setProperty("builddir",
                     self.path_module.join(
                         slavebuilder.slave.slave_basedir,
                         self.builder.config.slavebuilddir),
-                    "slave")
+                    "Slave")
 
         self.slavename = slavebuilder.slave.slavename
         self.build_status.setSlavename(self.slavename)


Test patch:
Repository: buildbot/buildbot

Issue:
Do not rely on BuildRequestStatus._buildrequest being non-None
Nor even on _getBuildRequest -- add a getter instead.

This is causing failures for Nate when forcing builds.



Discussion:

Resolving patch:
diff --git a/master/buildbot/buildslave.py b/master/buildbot/buildslave.py
--- a/master/buildbot/buildslave.py
+++ b/master/buildbot/buildslave.py
@@ -326,6 +326,8 @@ def _missing_timer_fired(self):
         text += "Sincerely,\n"
         text += " The Buildbot\n"
         text += " %s\n" % status.getTitleURL()
+        text += "\n"
+        text += "%s\n" % status.getURLForThing(self.slave_status)
         subject = "Buildbot: buildslave %s was lost" % self.slavename
         return self._mail_missing_message(subject, text)
 
diff --git a/master/buildbot/status/master.py b/master/buildbot/status/master.py
--- a/master/buildbot/status/master.py
+++ b/master/buildbot/status/master.py
@@ -160,6 +160,11 @@ def getURLForThing(self, thing):
         # IBuildSetStatus
         # IBuildRequestStatus
         # ISlaveStatus
+        if interfaces.ISlaveStatus.providedBy(thing):
+            slave = thing
+            return prefix + "buildslaves/%s" % (
+                    urllib.quote(slave.getName(), safe=''),
+                    )
 
         # IStatusEvent
         if interfaces.IStatusEvent.providedBy(thing):


Test patch: