Skip to content

Commit aedbf87

Browse files
authored
Merge branch 'postgres:main' into main
2 parents cfef760 + ee12867 commit aedbf87

36 files changed

+1501
-809
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ jobs:
2727

2828
- name: Run Biome
2929
run: biome ci .
30+
31+
- name: Install djhtml
32+
run: pip install djhtml
33+
34+
- name: Run djhtml
35+
run: djhtml pgcommitfest/*/templates/*.html pgcommitfest/*/templates/*.inc --tabwidth=1 --check

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
format:
22
ruff format
33
npx @biomejs/biome format --write
4+
djhtml pgcommitfest/*/templates/*.html pgcommitfest/*/templates/*.inc --tabwidth=1
45

56
lint:
67
ruff check

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ admin interface, go back to the main interface. You're now logged in.
7979

8080
## Contributing
8181

82-
Code formatting and linting is done using [`ruff`] and [`biome`]. You can run
83-
formatting using `make format`. Linting can be done using `make lint` and
84-
automatic fixing of linting errors can be done using `make lint-fix` or `make
85-
lint-fix-unsafe` (unsafe fixes can slightly change program behaviour, but often
86-
the fixed behaviour is the one you intended). You can also run both `make
87-
format` and `make lint-fix-unsafe` together by using `make fix`. CI
82+
Code formatting and linting is done using [`ruff`], [`biome`], and [`djhtml`].
83+
You can run formatting using `make format`. Linting can be done using `make
84+
lint` and automatic fixing of linting errors can be done using `make lint-fix`
85+
or `make lint-fix-unsafe` (unsafe fixes can slightly change program behaviour,
86+
but often the fixed behaviour is the one you intended). You can also run both
87+
`make format` and `make lint-fix-unsafe` together by using `make fix`. CI
8888
automatically checks that you adhere to these coding standards.
8989

9090
You can install the git pre-commit hook to help you adhere to the codestyle:
@@ -95,6 +95,7 @@ ln -s ../../tools/githook/pre-commit .git/hooks/
9595

9696
[`ruff`]: https://docs.astral.sh/ruff/
9797
[`biome`]: https://biomejs.dev/
98+
[`djhtml`]: https://github.com/rtts/djhtml
9899

99100
### Discord
100101

dev_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
uwsgi
33
pycodestyle
44
ruff
5+
djhtml

media/commitfest/css/commitfest.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ div.form-group div.controls ul li label input {
3030
}
3131
div.form-group div.controls input[type="checkbox"] {
3232
width: 10px;
33+
height: unset;
34+
display: inline-block;
35+
}
36+
div.form-group div.controls > div.form-control:has(input[type="checkbox"]) {
37+
display: flex;
38+
gap: 8px;
3339
}
3440

3541
div.form-group div.controls input.threadpick-input {
@@ -81,3 +87,7 @@ div.form-group div.controls input.threadpick-input {
8187
font-weight: bold;
8288
color: red;
8389
}
90+
91+
.search-bar {
92+
display: inline-block;
93+
}

pgcommitfest/commitfest/fixtures/commitfest_data.json

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,27 @@
216216
]
217217
}
218218
},
219+
{
220+
"model": "commitfest.patch",
221+
"pk": 7,
222+
"fields": {
223+
"name": "Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs",
224+
"topic": 3,
225+
"wikilink": "",
226+
"gitlink": "",
227+
"targetversion": null,
228+
"committer": null,
229+
"created": "2025-03-01T22:27:53.214",
230+
"modified": "2025-03-01T22:27:53.221",
231+
"lastmail": "2025-01-18T07:14:02",
232+
"authors": [],
233+
"reviewers": [],
234+
"subscribers": [],
235+
"mailthread_set": [
236+
7
237+
]
238+
}
239+
},
219240
{
220241
"model": "commitfest.patchoncommitfest",
221242
"pk": 1,
@@ -293,6 +314,17 @@
293314
"status": 6
294315
}
295316
},
317+
{
318+
"model": "commitfest.patchoncommitfest",
319+
"pk": 8,
320+
"fields": {
321+
"patch": 7,
322+
"commitfest": 2,
323+
"enterdate": "2025-03-01T22:27:53.214",
324+
"leavedate": null,
325+
"status": 1
326+
}
327+
},
296328
{
297329
"model": "commitfest.patchhistory",
298330
"pk": 1,
@@ -480,6 +512,28 @@
480512
"what": "Closed in commitfest Sample In Progress Commitfest with status: Rejected"
481513
}
482514
},
515+
{
516+
"model": "commitfest.patchhistory",
517+
"pk": 18,
518+
"fields": {
519+
"patch": 7,
520+
"date": "2025-03-01T22:27:53.215",
521+
"by": 1,
522+
"by_cfbot": false,
523+
"what": "Created patch record"
524+
}
525+
},
526+
{
527+
"model": "commitfest.patchhistory",
528+
"pk": 19,
529+
"fields": {
530+
"patch": 7,
531+
"date": "2025-03-01T22:27:53.218",
532+
"by": 1,
533+
"by_cfbot": false,
534+
"what": "Attached mail thread example@message-31"
535+
}
536+
},
483537
{
484538
"model": "commitfest.mailthread",
485539
"pk": 1,
@@ -564,6 +618,20 @@
564618
"latestmsgid": "example@message-16"
565619
}
566620
},
621+
{
622+
"model": "commitfest.mailthread",
623+
"pk": 7,
624+
"fields": {
625+
"messageid": "example@message-31",
626+
"subject": "Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs",
627+
"firstmessage": "2025-01-18T07:14:02",
628+
"firstauthor": "[email protected]",
629+
"latestmessage": "2025-01-18T07:14:02",
630+
"latestauthor": "[email protected]",
631+
"latestsubject": "Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs",
632+
"latestmsgid": "example@message-31"
633+
}
634+
},
567635
{
568636
"model": "commitfest.patchstatus",
569637
"pk": 1,
@@ -638,6 +706,7 @@
638706
"apply_url": "http://cfbot.cputube.org/patch_4573.log",
639707
"status": "finished",
640708
"needs_rebase_since": null,
709+
"failing_since": null,
641710
"created": "2025-01-26T22:06:02.980",
642711
"modified": "2025-01-29T22:50:37.805",
643712
"version": "",
@@ -657,10 +726,11 @@
657726
"commit_id": null,
658727
"apply_url": "http://cfbot.cputube.org/patch_4573.log",
659728
"status": "failed",
660-
"needs_rebase_since": null,
729+
"needs_rebase_since": "2025-03-01T22:30:42",
730+
"failing_since": "2025-02-01T22:30:42",
661731
"created": "2025-01-26T22:11:09.961",
662-
"modified": "2025-01-26T22:20:39.372",
663-
"version": null,
732+
"modified": "2025-03-01T22:59:14.717",
733+
"version": "",
664734
"patch_count": null,
665735
"first_additions": null,
666736
"first_deletions": null,
@@ -678,8 +748,9 @@
678748
"apply_url": "http://cfbot.cputube.org/patch_4748.log",
679749
"status": "failed",
680750
"needs_rebase_since": null,
751+
"failing_since": "2025-03-01T23:18:06",
681752
"created": "2025-01-26T22:22:46.602",
682-
"modified": "2025-01-29T22:58:51.032",
753+
"modified": "2025-03-01T23:18:10.856",
683754
"version": "",
684755
"patch_count": 3,
685756
"first_additions": 345,
@@ -698,6 +769,7 @@
698769
"apply_url": "http://cfbot.cputube.org/patch_4748.log",
699770
"status": "testing",
700771
"needs_rebase_since": null,
772+
"failing_since": null,
701773
"created": "2025-01-31T13:32:22.017",
702774
"modified": "2025-01-31T13:32:22.017",
703775
"version": "",
@@ -708,6 +780,27 @@
708780
"all_deletions": 14
709781
}
710782
},
783+
{
784+
"model": "commitfest.cfbotbranch",
785+
"pk": 7,
786+
"fields": {
787+
"branch_id": 12,
788+
"branch_name": "cf/7",
789+
"commit_id": "efg123",
790+
"apply_url": "http://cfbot.cputube.org/patch_7.log",
791+
"status": "timeout",
792+
"needs_rebase_since": null,
793+
"failing_since": "2025-03-01T22:29:07",
794+
"created": "2025-03-01T22:29:25.461",
795+
"modified": "2025-03-01T22:30:14.495",
796+
"version": "",
797+
"patch_count": 1,
798+
"first_additions": 1,
799+
"first_deletions": 2,
800+
"all_additions": 1,
801+
"all_deletions": 2
802+
}
803+
},
711804
{
712805
"model": "commitfest.cfbottask",
713806
"pk": 1,

pgcommitfest/commitfest/forms.py

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from django import forms
22
from django.contrib.auth.models import User
3-
from django.db.models import Q
43
from django.forms import ValidationError
54
from django.forms.widgets import HiddenInput
65
from django.http import Http404
@@ -11,36 +10,55 @@
1110

1211

1312
class CommitFestFilterForm(forms.Form):
13+
selectize_fields = {
14+
"author": "/lookups/user",
15+
"reviewer": "/lookups/user",
16+
}
17+
1418
text = forms.CharField(max_length=50, required=False)
1519
status = forms.ChoiceField(required=False)
1620
targetversion = forms.ChoiceField(required=False)
17-
author = forms.ChoiceField(required=False)
18-
reviewer = forms.ChoiceField(required=False)
21+
author = forms.ChoiceField(required=False, label="Author (type to search)")
22+
reviewer = forms.ChoiceField(required=False, label="Reviewer (type to search)")
1923
sortkey = forms.IntegerField(required=False)
2024

21-
def __init__(self, cf, *args, **kwargs):
22-
super(CommitFestFilterForm, self).__init__(*args, **kwargs)
25+
def __init__(self, data, *args, **kwargs):
26+
super(CommitFestFilterForm, self).__init__(data, *args, **kwargs)
2327

2428
self.fields["sortkey"].widget = forms.HiddenInput()
2529

2630
c = [(-1, "* All")] + list(PatchOnCommitFest._STATUS_CHOICES)
2731
self.fields["status"] = forms.ChoiceField(choices=c, required=False)
2832

29-
q = Q(patch_author__commitfests=cf) | Q(patch_reviewer__commitfests=cf)
30-
userchoices = [(-1, "* All"), (-2, "* None"), (-3, "* Yourself")] + [
31-
(u.id, "%s %s (%s)" % (u.first_name, u.last_name, u.username))
32-
for u in User.objects.filter(q)
33-
.distinct()
34-
.order_by("first_name", "last_name")
35-
]
33+
userchoices = [(-1, "* All"), (-2, "* None"), (-3, "* Yourself")]
34+
35+
selected_user_ids = set()
36+
if data and "author" in data:
37+
try:
38+
selected_user_ids.add(int(data["author"]))
39+
except ValueError:
40+
pass
41+
42+
if data and "reviewer" in data:
43+
try:
44+
selected_user_ids.add(int(data["reviewer"]))
45+
except ValueError:
46+
pass
47+
48+
if selected_user_ids:
49+
userchoices.extend(
50+
(u.id, f"{u.first_name} {u.last_name} ({u.username})")
51+
for u in User.objects.filter(pk__in=selected_user_ids)
52+
)
53+
3654
self.fields["targetversion"] = forms.ChoiceField(
3755
choices=[("-1", "* All"), ("-2", "* None")]
3856
+ [(v.id, v.version) for v in TargetVersion.objects.all()],
3957
required=False,
4058
label="Target version",
4159
)
42-
self.fields["author"] = forms.ChoiceField(choices=userchoices, required=False)
43-
self.fields["reviewer"] = forms.ChoiceField(choices=userchoices, required=False)
60+
self.fields["author"].choices = userchoices
61+
self.fields["reviewer"].choices = userchoices
4462

4563
for f in (
4664
"status",
@@ -51,7 +69,7 @@ def __init__(self, cf, *args, **kwargs):
5169

5270

5371
class PatchForm(forms.ModelForm):
54-
selectize_multiple_fields = {
72+
selectize_fields = {
5573
"authors": "/lookups/user",
5674
"reviewers": "/lookups/user",
5775
}
@@ -77,7 +95,7 @@ def __init__(self, *args, **kwargs):
7795
)
7896

7997
# Selectize multiple fields -- don't pre-populate everything
80-
for field, url in list(self.selectize_multiple_fields.items()):
98+
for field, url in list(self.selectize_fields.items()):
8199
# If this is a postback of a selectize field, it may contain ids that are not currently
82100
# stored in the field. They must still be among the *allowed* values of course, which
83101
# are handled by the existing queryset on the field.
@@ -94,8 +112,8 @@ def __init__(self, *args, **kwargs):
94112
self.fields[field].queryset = self.fields[field].queryset.filter(
95113
pk__in=set(vals)
96114
)
97-
self.fields[field].label_from_instance = lambda u: "{} ({})".format(
98-
u.username, u.get_full_name()
115+
self.fields[field].label_from_instance = (
116+
lambda u: f"{u.get_full_name()} ({u.username})"
99117
)
100118

101119
# Only allow modifying reviewers and committers if the patch is closed.

pgcommitfest/commitfest/lookups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def userlookup(request):
2525
"values": [
2626
{
2727
"id": u.id,
28-
"value": "{} ({})".format(u.username, u.get_full_name()),
28+
"value": f"{u.get_full_name()} ({u.username})",
2929
}
3030
for u in users
3131
],

pgcommitfest/commitfest/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class Migration(migrations.Migration):
170170
("wikilink", models.URLField(default="", null=False, blank=True)),
171171
("gitlink", models.URLField(default="", null=False, blank=True)),
172172
("created", models.DateTimeField(auto_now_add=True)),
173-
("modified", models.DateTimeField()),
173+
("modified", models.DateTimeField(auto_now_add=True)),
174174
("lastmail", models.DateTimeField(null=True, blank=True)),
175175
(
176176
"authors",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.2.19 on 2025-03-01 13:53
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("commitfest", "0009_extra_branch_fields"),
9+
]
10+
11+
operations = [
12+
migrations.AddField(
13+
model_name="cfbotbranch",
14+
name="failing_since",
15+
field=models.DateTimeField(blank=True, null=True),
16+
),
17+
]

0 commit comments

Comments
 (0)