How to use the buildbot.changes.changes.Change function in buildbot

To help you get started, we’ve selected a few buildbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buildbot / buildbot / buildbot / broken_test / runs / test_status.py View on Github external
def makeGenerator(self, reasons=[], minTime=0):
        b = MyBuilder("bname")
        b1 = b.newBuild()
        b1.setSourceStamp(SourceStamp(changes=[Change("foo", [], "")]))
        b1.buildStarted(b1, 1)
        b2 = b.newBuild()
        b2.setSourceStamp(SourceStamp(changes=[Change("bar", [], "")]))
        b2.buildStarted(b2, 2)
        return b.eventGenerator([], [], reasons, minTime)
github buildbot / buildbot / buildbot / broken_test / runs / test_status.py View on Github external
def test_notification_set_in_config(self):
        irc = MyContact(channel = MyChannel(notify_events = {'success': 1}))

        my_builder = MyBuilder("builder834")
        my_build = MyIrcBuild(my_builder, 862, builder.SUCCESS)
        my_build.changes = (
            Change(who = 'author1', files = ['file1'], comments = 'comment1', revision = "943"),
            )

        irc.message = ""
        irc.buildFinished(my_builder.getName(), my_build, None)
        self.failUnlessEqual(irc.message, "build #862 of builder834 is complete: Success [step1 step2]  Build details are at http://myserver/mypath?build=765", "Finish notification generated on success with notify_events=['success']")
github buildbot / buildbot / buildbot / broken_test / runs / test_status.py View on Github external
os.mkdir(basedir)
        mailer = MyMailer(fromaddr="buildbot@example.com", mode="problem",
                          extraRecipients=["recip@example.com",
                                           "recip2@example.com"],
                          lookup=MyLookup(),
                          customMesg=customTextMailMessage)
        mailer.parent = self
        mailer.master_status = self
        self.messages = []

        b1 = self.makeBuild(4, builder.FAILURE)
        b1.setProperty('buildnumber', 1, 'Build')
        b1.setText(["snarkleack", "polarization", "failed"])
        b1.blamelist = ["dev3", "dev3", "dev3", "dev4",
                        "Thomas_Walters"]
        b1.source.changes = (Change(who = 'author1', files = ['file1'], comments = 'comment1', revision = "123"),
                             Change(who = 'author2', files = ['file2'], comments = 'comment2', revision = "456"))
        b1.testlogs = [MyLog(basedir, 'compile', "Compile log here\n"),
                       MyLog(basedir, 'test', "Test log here\nTest 1 failed\nTest 2 failed\nTest 3 failed\nTest 4 failed\n")]

        mailer.buildFinished("builder1", b1, b1.results)
        m,r = self.messages.pop()
        t = m.as_string()
        #
        # Uncomment to review custom message
        #
        #self.fail(t)
        self.failUnlessIn("comment1", t)
        self.failUnlessIn("comment2", t)
        self.failUnlessIn("author2", t)
        self.failUnlessIn("Test 4 failed", t)
        self.failUnlessIn("number was: 1", t)
github buildbot / buildbot / buildbot / broken_test / runs / test_db.py View on Github external
spec.create_db()
        the_db = spec.open_db()
        self.dbs.add(the_db)
        runner.migrate_changes_pickle_to_db(fn, the_db, silent=True)
        m = ChangeManager()
        m.parent = FakeMaster()
        m.parent.db = the_db

        c1 = m.getChangeNumberedNow(1)
        self.failUnlessEqual(c1.who, "brian")
        self.failUnlessEqual(c1.files, sorted(["foo.c", "subdir/bar.c"]))
        self.failUnlessEqual(c1.comments, "first change")
        self.failUnlessEqual(c1.revision, "1234")
        # more..

        c3 = Change("alice", ["baz.c"], "third change", revision="abcd")
        m.addChange(c3)
github buildbot / buildbot / buildbot / broken_test / unit / test_buildreq.py View on Github external
def testMerge(self):
        R = BuildRequest
        S = sourcestamp.SourceStamp
        N = 'test_builder'
        b1 =  R("why", S("branch1", None, None, None), N)
        b1r1 = R("why2", S("branch1", "rev1", None, None), N)
        b1r1a = R("why not", S("branch1", "rev1", None, None), N)
        b1r2 = R("why3", S("branch1", "rev2", None, None), N)
        b2r2 = R("why4", S("branch2", "rev2", None, None), N)
        b1r1p1 = R("why5", S("branch1", "rev1", (3, "diff"), None), N)
        c1 = Change("alice", [], "changed stuff", branch="branch1")
        c2 = Change("alice", [], "changed stuff", branch="branch1")
        c3 = Change("alice", [], "changed stuff", branch="branch1")
        c4 = Change("alice", [], "changed stuff", branch="branch1")
        c5 = Change("alice", [], "changed stuff", branch="branch1")
        c6 = Change("alice", [], "changed stuff", branch="branch1")
        b1c1 = R("changes", S("branch1", None, None, [c1,c2,c3]), N)
        b1c2 = R("changes", S("branch1", None, None, [c4,c5,c6]), N)

        self.failUnless(b1.canBeMergedWith(b1))
        self.failIf(b1.canBeMergedWith(b1r1))
        self.failIf(b1.canBeMergedWith(b2r2))
        self.failIf(b1.canBeMergedWith(b1r1p1))
        self.failIf(b1.canBeMergedWith(b1c1))

        self.failIf(b1r1.canBeMergedWith(b1))
        self.failUnless(b1r1.canBeMergedWith(b1r1))
        self.failIf(b1r1.canBeMergedWith(b2r2))
github buildbot / buildbot / buildbot / broken_test / runs / test_db.py View on Github external
def create_pickle(self):
        # ugh, what was I thinking? pickles? with class instances? ick.
        cm = OldChangeMaster()
        cm.basedir = "db/migrate"
        os.makedirs(cm.basedir)
        c1 = Change(who="brian", files=["foo.c", "subdir/bar.c"],
                    comments="first change",
                    revision="1234")
        del c1.revlink
        c2 = Change(who="brian", files=["foo.c"],
                    comments="second change",
                    revision="1235", branch="release",
                    links=["url1", "url2"], revlink="url3",
                    properties={"who": "what"},
                    category="nifty")
        cm.addChange(c1)
        cm.addChange(c2)
        cm.saveYourself() # db/migrate/changes.pck
        return os.path.join(cm.basedir, "changes.pck")
github buildbot / buildbot / buildbot / broken_test / unit / test_scheduler.py View on Github external
def testAnyBranch(self):
        self.basedir = 'scheduler/Scheduling/AnyBranch'
        self.create_master()
        s = scheduler.AnyBranchScheduler("b1", 1, ["a", "b"],
                                         fileIsImportant=self.isImportant)
        d = self.setSchedulers(s)

        def _addChange(ign, c):
            self.master.change_svc.addChange(c)

        c1 = Change("alice", ["important", "not important"], "some changes",
                    branch="branch1")
        d.addCallback(_addChange, c1)
        c2 = Change("bob", ["not important", "boring"], "some more changes",
                    branch="branch1")
        d.addCallback(_addChange, c2)
        c3 = Change("carol", ["important", "dull"], "even more changes",
                    branch="branch1")
        d.addCallback(_addChange, c3)

        c4 = Change("carol", ["important"], "other branch", branch="branch2")
        d.addCallback(_addChange, c4)

        c5 = Change("carol", ["important"], "default branch", branch=None)
        d.addCallback(_addChange, c5)

        d.addCallback(lambda ign: self.master.scheduler_manager.when_quiet())

        d.addCallback(self._testAnyBranch_1)
        return d
github GNOME / jhbuild / jhbuild / buildbot / changes.py View on Github external
else:
                    comments += line[4:] + '\n'

            comments = unicode(comments.strip(), m.get_content_charset() or 'ascii', 'ignore')

        c = changes.Change(name, files, comments, isdir, revision=revision, links=links, when=when)
        c.project = project
        c.git_module_name = project

        # some modules may have alternate checkouts under different names, look
        # for those, and create appropriate Change objects
        for module in self.modules:
            if hasattr(module, 'branch') and isinstance(module.branch, GitBranch):
                git_module_name = module.branch.module.rsplit('/', 1)[-1]
                if module.name != project and git_module_name == project:
                    change = changes.Change(name, files, comments, isdir,
                                    revision=revision, links=links, when=when)
                    change.project = module.name
                    change.git_module_name = git_module_name
                    self.parent.addChange(change)

        return c
github buildbot / buildbot / master / buildbot / schedulers / base.py View on Github external
def _changeCallback(self, key, msg, fileIsImportant, change_filter,
                        onlyImportant):

        # ignore changes delivered while we're not running
        if not self._change_consumer:
            return

        # get a change object, since the API requires it
        chdict = yield self.master.db.changes.getChange(msg['changeid'])
        change = yield changes.Change.fromChdict(self.master, chdict)

        # filter it
        if change_filter and not change_filter.filter_change(change):
            return
        if change.codebase not in self.codebases:
            log.msg(format='change contains codebase %(codebase)s that is '
                    'not processed by scheduler %(name)s',
                    codebase=change.codebase, name=self.name)
            return

        if fileIsImportant:
            try:
                important = fileIsImportant(change)
                if not important and onlyImportant:
                    return
            except Exception:
github buildbot / buildbot / master / buildbot / master.py View on Github external
need_setState = True

        if self._last_processed_change is None:
            timer.stop()
            return

        while True:
            changeid = self._last_processed_change + 1
            chdict = yield self.db.changes.getChange(changeid)

            # if there's no such change, we've reached the end and can
            # stop polling
            if not chdict:
                break

            change = yield changes.Change.fromChdict(self, chdict)

            self._change_subs.deliver(change)

            self._last_processed_change = changeid
            need_setState = True

        # write back the updated state, if it's changed
        if need_setState:
            yield self._setState('last_processed_change',
                            self._last_processed_change)
        timer.stop()