From f112ea0e1ead18ec2de363baa72bc1ce18267d23 Mon Sep 17 00:00:00 2001 From: Andrey Borodin Date: Tue, 6 Jan 2026 12:50:59 +0500 Subject: [PATCH 1/2] Don't show committed patches as needing rebase --- .../commitfest/templates/commitfest.html | 2 +- pgcommitfest/commitfest/templates/home.html | 2 +- pgcommitfest/commitfest/templates/patch.html | 2 +- pgcommitfest/commitfest/views.py | 22 ++++++++++++++++--- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/pgcommitfest/commitfest/templates/commitfest.html b/pgcommitfest/commitfest/templates/commitfest.html index 357d6bc1..a6377de8 100644 --- a/pgcommitfest/commitfest/templates/commitfest.html +++ b/pgcommitfest/commitfest/templates/commitfest.html @@ -68,7 +68,7 @@

{{p.is_open|yesno:"Active patches,Closed patches"}}

{%with p.cfbot_results as cfb%} {%if not cfb %} Not processed - {%elif p.needs_rebase_since %} + {%elif p.needs_rebase_since and p.status != 4 %} Needs rebase! diff --git a/pgcommitfest/commitfest/templates/home.html b/pgcommitfest/commitfest/templates/home.html index e83b2ab7..3caa836e 100644 --- a/pgcommitfest/commitfest/templates/home.html +++ b/pgcommitfest/commitfest/templates/home.html @@ -174,7 +174,7 @@

{%if user.is_authenticated%}Open patches you are subscribed to{%elif p.is_op {%with p.cfbot_results as cfb%} {%if not cfb %} Not processed - {%elif p.needs_rebase_since %} + {%elif p.needs_rebase_since and p.status != 4 %} Needs rebase! diff --git a/pgcommitfest/commitfest/templates/patch.html b/pgcommitfest/commitfest/templates/patch.html index e48b5bd2..0a276654 100644 --- a/pgcommitfest/commitfest/templates/patch.html +++ b/pgcommitfest/commitfest/templates/patch.html @@ -24,7 +24,7 @@ {%if not cfbot_branch %} Not processed - {%elif cfbot_branch.needs_rebase_since %} + {%elif cfbot_branch.needs_rebase_since and not current_poc.is_committed %} Needs rebase! 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%}
Additional links previous successfully applied patch (outdated):
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index b2d64c48..fa3feb75 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -431,7 +431,7 @@ def patchlist(request, cf, personalized=False): SELECT 1 FROM commitfest_patch_authors cpa WHERE cpa.patch_id=p.id AND cpa.user_id=%(self)s ) AND ( poc.status=%(needs_author)s - OR branch.needs_rebase_since IS NOT NULL + OR (branch.needs_rebase_since IS NOT NULL AND poc.status != %(committed_status)s) OR branch.failing_since + interval '4 days' < now() OR (%(is_committer)s AND poc.status=%(needs_committer)s) ) @@ -451,6 +451,7 @@ def patchlist(request, cf, personalized=False): """ whereparams["needs_author"] = PatchOnCommitFest.STATUS_AUTHOR whereparams["needs_committer"] = PatchOnCommitFest.STATUS_COMMITTER + whereparams["committed_status"] = PatchOnCommitFest.STATUS_COMMITTED whereparams["closed_status"] = CommitFest.STATUS_CLOSED is_committer = bool(Committer.objects.filter(user=request.user, active=True)) whereparams["is_committer"] = is_committer @@ -1278,7 +1279,18 @@ def close(request, patchid, status): "feedback": PatchOnCommitFest.STATUS_RETURNED, "committed": PatchOnCommitFest.STATUS_COMMITTED, } - poc.set_status(status_mapping[status]) + new_status = status_mapping[status] + poc.set_status(new_status) + + # Clear needs_rebase_since if patch is being marked as committed + if new_status == PatchOnCommitFest.STATUS_COMMITTED: + try: + cfbot_branch = poc.patch.cfbot_branch + if cfbot_branch.needs_rebase_since: + cfbot_branch.needs_rebase_since = None + cfbot_branch.save() + except CfbotBranch.DoesNotExist: + pass PatchHistory( patch=poc.patch, @@ -1638,7 +1650,11 @@ def cfbot_ingest(message): # state so we can skip sending notifications if the needs_rebase status did # not change. needs_save = False - needs_rebase = branch_status["commit_id"] is None + # Check if patch is committed - committed patches don't need rebase + is_committed = PatchOnCommitFest.objects.filter( + patch=patch, status=PatchOnCommitFest.STATUS_COMMITTED + ).exists() + needs_rebase = branch_status["commit_id"] is None and not is_committed if bool(branch_in_db.needs_rebase_since) is not needs_rebase: if needs_rebase: branch_in_db.needs_rebase_since = datetime.now() From 0d3a8df2b7cc228807114ed228d2da8e27786950 Mon Sep 17 00:00:00 2001 From: Andrey Borodin Date: Wed, 7 Jan 2026 14:40:21 +0500 Subject: [PATCH 2/2] Hide 'needs rebase' for all closed statuses --- .../commitfest/templates/commitfest.html | 2 +- pgcommitfest/commitfest/templates/home.html | 2 +- pgcommitfest/commitfest/templates/patch.html | 2 +- pgcommitfest/commitfest/views.py | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pgcommitfest/commitfest/templates/commitfest.html b/pgcommitfest/commitfest/templates/commitfest.html index a6377de8..6f012e98 100644 --- a/pgcommitfest/commitfest/templates/commitfest.html +++ b/pgcommitfest/commitfest/templates/commitfest.html @@ -68,7 +68,7 @@

{{p.is_open|yesno:"Active patches,Closed patches"}}

{%with p.cfbot_results as cfb%} {%if not cfb %} Not processed - {%elif p.needs_rebase_since and p.status != 4 %} + {%elif p.needs_rebase_since and p.status < 4 %} Needs rebase! diff --git a/pgcommitfest/commitfest/templates/home.html b/pgcommitfest/commitfest/templates/home.html index 3caa836e..b694dfc4 100644 --- a/pgcommitfest/commitfest/templates/home.html +++ b/pgcommitfest/commitfest/templates/home.html @@ -174,7 +174,7 @@

{%if user.is_authenticated%}Open patches you are subscribed to{%elif p.is_op {%with p.cfbot_results as cfb%} {%if not cfb %} Not processed - {%elif p.needs_rebase_since and p.status != 4 %} + {%elif p.needs_rebase_since and p.status < 4 %} Needs rebase! diff --git a/pgcommitfest/commitfest/templates/patch.html b/pgcommitfest/commitfest/templates/patch.html index 0a276654..9df40a12 100644 --- a/pgcommitfest/commitfest/templates/patch.html +++ b/pgcommitfest/commitfest/templates/patch.html @@ -24,7 +24,7 @@ {%if not cfbot_branch %} Not processed - {%elif cfbot_branch.needs_rebase_since and not current_poc.is_committed %} + {%elif cfbot_branch.needs_rebase_since and not current_poc.is_closed %} Needs rebase! 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%}
Additional links previous successfully applied patch (outdated):
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index fa3feb75..75c57ccf 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -431,7 +431,7 @@ def patchlist(request, cf, personalized=False): SELECT 1 FROM commitfest_patch_authors cpa WHERE cpa.patch_id=p.id AND cpa.user_id=%(self)s ) AND ( poc.status=%(needs_author)s - OR (branch.needs_rebase_since IS NOT NULL AND poc.status != %(committed_status)s) + OR (branch.needs_rebase_since IS NOT NULL AND poc.status=ANY(%(open_statuses)s)) OR branch.failing_since + interval '4 days' < now() OR (%(is_committer)s AND poc.status=%(needs_committer)s) ) @@ -451,7 +451,7 @@ def patchlist(request, cf, personalized=False): """ whereparams["needs_author"] = PatchOnCommitFest.STATUS_AUTHOR whereparams["needs_committer"] = PatchOnCommitFest.STATUS_COMMITTER - whereparams["committed_status"] = PatchOnCommitFest.STATUS_COMMITTED + whereparams["open_statuses"] = PatchOnCommitFest.OPEN_STATUSES whereparams["closed_status"] = CommitFest.STATUS_CLOSED is_committer = bool(Committer.objects.filter(user=request.user, active=True)) whereparams["is_committer"] = is_committer @@ -1282,8 +1282,8 @@ def close(request, patchid, status): new_status = status_mapping[status] poc.set_status(new_status) - # Clear needs_rebase_since if patch is being marked as committed - if new_status == PatchOnCommitFest.STATUS_COMMITTED: + # Clear needs_rebase_since if patch is being closed (all closed statuses) + if new_status not in PatchOnCommitFest.OPEN_STATUSES: try: cfbot_branch = poc.patch.cfbot_branch if cfbot_branch.needs_rebase_since: @@ -1650,11 +1650,11 @@ def cfbot_ingest(message): # state so we can skip sending notifications if the needs_rebase status did # not change. needs_save = False - # Check if patch is committed - committed patches don't need rebase - is_committed = PatchOnCommitFest.objects.filter( - patch=patch, status=PatchOnCommitFest.STATUS_COMMITTED + # Check if patch has at least one open poc - only open patches can need rebase + has_open_poc = PatchOnCommitFest.objects.filter( + patch=patch, status__in=PatchOnCommitFest.OPEN_STATUSES ).exists() - needs_rebase = branch_status["commit_id"] is None and not is_committed + needs_rebase = branch_status["commit_id"] is None and has_open_poc if bool(branch_in_db.needs_rebase_since) is not needs_rebase: if needs_rebase: branch_in_db.needs_rebase_since = datetime.now()