Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pgcommitfest/commitfest/templates/commitfest.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h3>{{p.is_open|yesno:"Active patches,Closed patches"}}</h3>
{%with p.cfbot_results as cfb%}
{%if not cfb %}
<span class="badge bg-secondary">Not processed</span>
{%elif p.needs_rebase_since %}
{%elif p.needs_rebase_since and p.status < 4 %}
<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%}">
<span class="badge bg-warning">Needs rebase!</span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion pgcommitfest/commitfest/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ <h3>{%if user.is_authenticated%}Open patches you are subscribed to{%elif p.is_op
{%with p.cfbot_results as cfb%}
{%if not cfb %}
<span class="badge bg-secondary">Not processed</span>
{%elif p.needs_rebase_since %}
{%elif p.needs_rebase_since and p.status < 4 %}
<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%}">
<span class="badge bg-warning">Needs rebase!</span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion pgcommitfest/commitfest/templates/patch.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<td>
{%if not cfbot_branch %}
<span class="badge bg-secondary">Not processed</span></a>
{%elif cfbot_branch.needs_rebase_since %}
{%elif cfbot_branch.needs_rebase_since and not current_poc.is_closed %}
<a href="{{cfbot_branch.apply_url}}">
<span class="badge bg-warning" title="View git apply logs">Needs rebase!</span></a>
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>
Expand Down
22 changes: 19 additions & 3 deletions pgcommitfest/commitfest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down