@@ -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