From fa2bba3cb9d5d353f2f6f38f451ea0b30cdeac04 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 12 Feb 2024 08:46:44 +0100 Subject: [PATCH] [CHG] runbot_merge: don't reset cancel_staging on r- Also send skipchecks removal to the PR being r-'d, as sending it to a random PR of the batch doesn't really make sense? --- runbot_merge/models/pull_requests.py | 4 +--- runbot_merge/tests/test_basic.py | 11 ++--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index 02eab8c4..4413857a 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -700,8 +700,6 @@ class PullRequests(models.Model): else: msg = self._approve(author, login) case commands.Reject() if is_author: - if self.batch_id.cancel_staging: - self.batch_id.cancel_staging = False if self.batch_id.skipchecks or self.reviewed_by: if self.error: self.error = False @@ -712,7 +710,7 @@ class PullRequests(models.Model): self.env.ref("runbot_merge.command.unapprove.p0")._send( repository=self.repository, pull_request=self.number, - format_args={'user': login, 'pr': self.batch_id.prs[:1]}, + format_args={'user': login, 'pr': self}, ) self.unstage("unreviewed (r-) by %s", login) else: diff --git a/runbot_merge/tests/test_basic.py b/runbot_merge/tests/test_basic.py index dc458b34..d7653513 100644 --- a/runbot_merge/tests/test_basic.py +++ b/runbot_merge/tests/test_basic.py @@ -2880,17 +2880,10 @@ class TestBatching(object): assert p_01.state == 'opened' assert p_01.priority == 'alone' assert p_01.skipchecks == False - assert p_01.cancel_staging == False + assert p_01.cancel_staging == True - p_01.batch_id.cancel_staging = True - # FIXME: cancel_staging should only cancel when the PR is or - # transitions to ready - # assert staging_4.active - # re-staging, should not be necessary - env.run_crons() + assert staging_4.active, "staging should not be disabled" - staging_5 = ensure_one(sm_all.staging_id) - assert staging_5.active # cause the PR to become ready the normal way with repo: pr01.post_comment("hansen r+", config['role_reviewer']['token'])