diff --git a/pgcommitfest/commitfest/templates/commitfest.html b/pgcommitfest/commitfest/templates/commitfest.html index 357d6bc1..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 %} + {%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..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 %} + {%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..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 %} + {%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 b2d64c48..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 + 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,6 +451,7 @@ def patchlist(request, cf, personalized=False): """ whereparams["needs_author"] = PatchOnCommitFest.STATUS_AUTHOR whereparams["needs_committer"] = PatchOnCommitFest.STATUS_COMMITTER + 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 @@ -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 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: + 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 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 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()