Skip to content

Commit f112ea0

Browse files
committed
Don't show committed patches as needing rebase
1 parent fbd6aa7 commit f112ea0

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

pgcommitfest/commitfest/templates/commitfest.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ <h3>{{p.is_open|yesno:"Active patches,Closed patches"}}</h3>
6868
{%with p.cfbot_results as cfb%}
6969
{%if not cfb %}
7070
<span class="badge bg-secondary">Not processed</span>
71-
{%elif p.needs_rebase_since %}
71+
{%elif p.needs_rebase_since and p.status != 4 %}
7272
<a href="{{cfb.apply_url}}" title="View git apply logs. Needs rebase {% cfsince p.needs_rebase_since %}. {%if p.failing_since and p.failing_since != p.needs_rebase_since %}Failing {% cfsince p.failing_since %}.{%endif%}">
7373
<span class="badge bg-warning">Needs rebase!</span>
7474
</a>

pgcommitfest/commitfest/templates/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ <h3>{%if user.is_authenticated%}Open patches you are subscribed to{%elif p.is_op
174174
{%with p.cfbot_results as cfb%}
175175
{%if not cfb %}
176176
<span class="badge bg-secondary">Not processed</span>
177-
{%elif p.needs_rebase_since %}
177+
{%elif p.needs_rebase_since and p.status != 4 %}
178178
<a href="{{cfb.apply_url}}" title="View git apply logs. Needs rebase {% cfsince p.needs_rebase_since %}. {%if p.failing_since and p.failing_since != p.needs_rebase_since %}Failing {% cfsince p.failing_since %}.{%endif%}">
179179
<span class="badge bg-warning">Needs rebase!</span>
180180
</a>

pgcommitfest/commitfest/templates/patch.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<td>
2525
{%if not cfbot_branch %}
2626
<span class="badge bg-secondary">Not processed</span></a>
27-
{%elif cfbot_branch.needs_rebase_since %}
27+
{%elif cfbot_branch.needs_rebase_since and not current_poc.is_committed %}
2828
<a href="{{cfbot_branch.apply_url}}">
2929
<span class="badge bg-warning" title="View git apply logs">Needs rebase!</span></a>
3030
Needs rebase {% cfsince cfbot_branch.needs_rebase_since %}. {%if cfbot_branch.failing_since and cfbot_branch.failing_since != cfbot_branch.needs_rebase_since %}Failing {% cfsince cfbot_branch.failing_since %}. {%endif%}<br>Additional links previous successfully applied patch (outdated):<br>

pgcommitfest/commitfest/views.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def patchlist(request, cf, personalized=False):
431431
SELECT 1 FROM commitfest_patch_authors cpa WHERE cpa.patch_id=p.id AND cpa.user_id=%(self)s
432432
) AND (
433433
poc.status=%(needs_author)s
434-
OR branch.needs_rebase_since IS NOT NULL
434+
OR (branch.needs_rebase_since IS NOT NULL AND poc.status != %(committed_status)s)
435435
OR branch.failing_since + interval '4 days' < now()
436436
OR (%(is_committer)s AND poc.status=%(needs_committer)s)
437437
)
@@ -451,6 +451,7 @@ def patchlist(request, cf, personalized=False):
451451
"""
452452
whereparams["needs_author"] = PatchOnCommitFest.STATUS_AUTHOR
453453
whereparams["needs_committer"] = PatchOnCommitFest.STATUS_COMMITTER
454+
whereparams["committed_status"] = PatchOnCommitFest.STATUS_COMMITTED
454455
whereparams["closed_status"] = CommitFest.STATUS_CLOSED
455456
is_committer = bool(Committer.objects.filter(user=request.user, active=True))
456457
whereparams["is_committer"] = is_committer
@@ -1278,7 +1279,18 @@ def close(request, patchid, status):
12781279
"feedback": PatchOnCommitFest.STATUS_RETURNED,
12791280
"committed": PatchOnCommitFest.STATUS_COMMITTED,
12801281
}
1281-
poc.set_status(status_mapping[status])
1282+
new_status = status_mapping[status]
1283+
poc.set_status(new_status)
1284+
1285+
# Clear needs_rebase_since if patch is being marked as committed
1286+
if new_status == PatchOnCommitFest.STATUS_COMMITTED:
1287+
try:
1288+
cfbot_branch = poc.patch.cfbot_branch
1289+
if cfbot_branch.needs_rebase_since:
1290+
cfbot_branch.needs_rebase_since = None
1291+
cfbot_branch.save()
1292+
except CfbotBranch.DoesNotExist:
1293+
pass
12821294

12831295
PatchHistory(
12841296
patch=poc.patch,
@@ -1638,7 +1650,11 @@ def cfbot_ingest(message):
16381650
# state so we can skip sending notifications if the needs_rebase status did
16391651
# not change.
16401652
needs_save = False
1641-
needs_rebase = branch_status["commit_id"] is None
1653+
# Check if patch is committed - committed patches don't need rebase
1654+
is_committed = PatchOnCommitFest.objects.filter(
1655+
patch=patch, status=PatchOnCommitFest.STATUS_COMMITTED
1656+
).exists()
1657+
needs_rebase = branch_status["commit_id"] is None and not is_committed
16421658
if bool(branch_in_db.needs_rebase_since) is not needs_rebase:
16431659
if needs_rebase:
16441660
branch_in_db.needs_rebase_since = datetime.now()

0 commit comments

Comments
 (0)