OLD | NEW |
1 URL: http://buildbot.net/trac | 1 URL: http://buildbot.net/trac |
2 Version: 0.8.4p1 | 2 Version: 0.8.4p1 |
3 License: GNU General Public License (GPL) Version 2 | 3 License: GNU General Public License (GPL) Version 2 |
4 | 4 |
5 This is a forked copy of buildbot v0.8.4p1. | 5 This is a forked copy of buildbot v0.8.4p1. |
6 | 6 |
7 Make hidden steps stay hidden even if not finished, add brDoStepIf | 7 Make hidden steps stay hidden even if not finished, add brDoStepIf |
8 to support buildrunner. | 8 to support buildrunner. |
9 | 9 |
10 | 10 |
(...skipping 3798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3809 | 3809 |
3810 @@ -123,7 +124,7 @@ class StatusResourceBuild(HtmlResource): | 3810 @@ -123,7 +124,7 @@ class StatusResourceBuild(HtmlResource): |
3811 for l in s.getLogs(): | 3811 for l in s.getLogs(): |
3812 logname = l.getName() | 3812 logname = l.getName() |
3813 step['logs'].append({ 'link': req.childLink("steps/%s/logs/%s"
% | 3813 step['logs'].append({ 'link': req.childLink("steps/%s/logs/%s"
% |
3814 - (urllib.quote(s.getName()), | 3814 - (urllib.quote(s.getName()), |
3815 + (urllib.quote(s.getName(), safe=''), | 3815 + (urllib.quote(s.getName(), safe=''), |
3816 urllib.quote(logname))), | 3816 urllib.quote(logname))), |
3817 'name': logname }) | 3817 'name': logname }) |
3818 | 3818 |
| 3819 |
| 3820 Backport BuildsetsConnectComponent.getRecentBuildsets from upstream |
| 3821 (1ee6d421be2ea814c11757263eb43152f8c3928e). |
| 3822 |
| 3823 Index: third_party/buildbot_8_4p1/buildbot/db/buildsets.py |
| 3824 diff --git a/third_party/buildbot_8_4p1/buildbot/db/buildsets.py b/third_party/b
uildbot_8_4p1/buildbot/db/buildsets.py |
| 3825 index e70a51242ca09ba7ec7034e2092f4053c3d0332c..c90af5bec8eb57e5075858623fcc5d59
a62eadd7 100644 |
| 3826 --- a/third_party/buildbot_8_4p1/buildbot/db/buildsets.py |
| 3827 +++ b/third_party/buildbot_8_4p1/buildbot/db/buildsets.py |
| 3828 @@ -190,6 +190,35 @@ class BuildsetsConnectorComponent(base.DBConnectorComponent
): |
| 3829 return [ self._row2dict(row) for row in res.fetchall() ] |
| 3830 return self.db.pool.do(thd) |
| 3831 |
| 3832 + def getRecentBuildsets(self, count, branch=None, repository=None, |
| 3833 + complete=None): |
| 3834 + def thd(conn): |
| 3835 + bs_tbl = self.db.model.buildsets |
| 3836 + ch_tbl = self.db.model.changes |
| 3837 + j = sa.join(self.db.model.buildsets, |
| 3838 + self.db.model.sourcestamps) |
| 3839 + j = j.join(self.db.model.sourcestamp_changes) |
| 3840 + j = j.join(ch_tbl) |
| 3841 + q = sa.select(columns=[bs_tbl], from_obj=[j], |
| 3842 + distinct=True) |
| 3843 + q = q.order_by(sa.desc(bs_tbl.c.id)) |
| 3844 + q = q.limit(count) |
| 3845 + |
| 3846 + if complete is not None: |
| 3847 + if complete: |
| 3848 + q = q.where(bs_tbl.c.complete != 0) |
| 3849 + else: |
| 3850 + q = q.where((bs_tbl.c.complete == 0) | |
| 3851 + (bs_tbl.c.complete == None)) |
| 3852 + if branch: |
| 3853 + q = q.where(ch_tbl.c.branch == branch) |
| 3854 + if repository: |
| 3855 + q = q.where(ch_tbl.c.repository == repository) |
| 3856 + res = conn.execute(q) |
| 3857 + return list(reversed([self._row2dict(row) |
| 3858 + for row in res.fetchall()])) |
| 3859 + return self.db.pool.do(thd) |
| 3860 + |
| 3861 def getBuildsetProperties(self, buildsetid): |
| 3862 """ |
| 3863 Return the properties for a buildset, in the same format they were |
| 3864 Index: third_party/buildbot_8_4p1/buildbot/test/unit/test_db_buildsets.py |
| 3865 diff --git a/third_party/buildbot_8_4p1/buildbot/test/unit/test_db_buildsets.py
b/third_party/buildbot_8_4p1/buildbot/test/unit/test_db_buildsets.py |
| 3866 index a6d4253cae43572992eac8d73b24cead97f63d9e..d28bcc61a72fd875af51c533b4ae1891
72225041 100644 |
| 3867 --- a/third_party/buildbot_8_4p1/buildbot/test/unit/test_db_buildsets.py |
| 3868 +++ b/third_party/buildbot_8_4p1/buildbot/test/unit/test_db_buildsets.py |
| 3869 @@ -441,3 +441,91 @@ class TestBuildsetsConnectorComponent( |
| 3870 d.addCallbacks(cb, eb) |
| 3871 return d |
| 3872 |
| 3873 + def insert_test_getRecentBuildsets_data(self): |
| 3874 + return self.insertTestData([ |
| 3875 + fakedb.Change(changeid=91, branch='branch_a', repository='repo_a'), |
| 3876 + fakedb.SourceStamp(id=91, branch='branch_a', repository='repo_a'), |
| 3877 + fakedb.SourceStampChange(sourcestampid=91, changeid=91), |
| 3878 + |
| 3879 + fakedb.Buildset(id=91, sourcestampid=91, complete=0, |
| 3880 + complete_at=298297875, results=-1, submitted_at=266761875, |
| 3881 + external_idstring='extid', reason='rsn1'), |
| 3882 + fakedb.Buildset(id=92, sourcestampid=91, complete=1, |
| 3883 + complete_at=298297876, results=7, submitted_at=266761876, |
| 3884 + external_idstring='extid', reason='rsn2'), |
| 3885 + |
| 3886 + # buildset unrelated to the change |
| 3887 + fakedb.Buildset(id=93, sourcestampid=1, complete=1, |
| 3888 + complete_at=298297877, results=7, submitted_at=266761877, |
| 3889 + external_idstring='extid', reason='rsn2'), |
| 3890 + ]) |
| 3891 + |
| 3892 + def test_getRecentBuildsets_all(self): |
| 3893 + d = self.insert_test_getRecentBuildsets_data() |
| 3894 + d.addCallback(lambda _ : |
| 3895 + self.db.buildsets.getRecentBuildsets(2, branch='branch_a', |
| 3896 + repository='repo_a')) |
| 3897 + def check(bsdictlist): |
| 3898 + self.assertEqual(bsdictlist, [ |
| 3899 + dict(external_idstring='extid', reason='rsn1', sourcestampid=91, |
| 3900 + submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 15, |
| 3901 + tzinfo=UTC), |
| 3902 + complete_at=datetime.datetime(1979, 6, 15, 12, 31, 15, |
| 3903 + tzinfo=UTC), |
| 3904 + complete=False, results=-1, bsid=91), |
| 3905 + dict(external_idstring='extid', reason='rsn2', sourcestampid=91, |
| 3906 + submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 16, |
| 3907 + tzinfo=UTC), |
| 3908 + complete_at=datetime.datetime(1979, 6, 15, 12, 31, 16, |
| 3909 + tzinfo=UTC), |
| 3910 + complete=True, results=7, bsid=92), |
| 3911 + ]) |
| 3912 + d.addCallback(check) |
| 3913 + return d |
| 3914 + |
| 3915 + def test_getRecentBuildsets_one(self): |
| 3916 + d = self.insert_test_getRecentBuildsets_data() |
| 3917 + d.addCallback(lambda _ : |
| 3918 + self.db.buildsets.getRecentBuildsets(1, branch='branch_a', |
| 3919 + repository='repo_a')) |
| 3920 + def check(bsdictlist): |
| 3921 + self.assertEqual(bsdictlist, [ |
| 3922 + dict(external_idstring='extid', reason='rsn2', sourcestampid=91, |
| 3923 + submitted_at=datetime.datetime(1978, 6, 15, 12, 31, 16, |
| 3924 + tzinfo=UTC), |
| 3925 + complete_at=datetime.datetime(1979, 6, 15, 12, 31, 16, |
| 3926 + tzinfo=UTC), |
| 3927 + complete=True, results=7, bsid=92), |
| 3928 + ]) |
| 3929 + d.addCallback(check) |
| 3930 + return d |
| 3931 + |
| 3932 + def test_getRecentBuildsets_zero(self): |
| 3933 + d = self.insert_test_getRecentBuildsets_data() |
| 3934 + d.addCallback(lambda _ : |
| 3935 + self.db.buildsets.getRecentBuildsets(0, branch='branch_a', |
| 3936 + repository='repo_a')) |
| 3937 + def check(bsdictlist): |
| 3938 + self.assertEqual(bsdictlist, []) |
| 3939 + d.addCallback(check) |
| 3940 + return d |
| 3941 + |
| 3942 + def test_getRecentBuildsets_noBranchMatch(self): |
| 3943 + d = self.insert_test_getRecentBuildsets_data() |
| 3944 + d.addCallback(lambda _ : |
| 3945 + self.db.buildsets.getRecentBuildsets(2, branch='bad_branch', |
| 3946 + repository='repo_a')) |
| 3947 + def check(bsdictlist): |
| 3948 + self.assertEqual(bsdictlist, []) |
| 3949 + d.addCallback(check) |
| 3950 + return d |
| 3951 + |
| 3952 + def test_getRecentBuildsets_noRepoMatch(self): |
| 3953 + d = self.insert_test_getRecentBuildsets_data() |
| 3954 + d.addCallback(lambda _ : |
| 3955 + self.db.buildsets.getRecentBuildsets(2, branch='branch_a', |
| 3956 + repository='bad_repo')) |
| 3957 + def check(bsdictlist): |
| 3958 + self.assertEqual(bsdictlist, []) |
| 3959 + d.addCallback(check) |
| 3960 + return d |
OLD | NEW |