From 37f08d7f2d3e375595afbbf4b0238b69032c3d7b Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Fri, 27 Feb 2026 19:37:39 +0100 Subject: [PATCH] If patch fails to apply, warn it is likely to fail to land and provide instructions how to resolve --- bot/code_review_bot/analysis.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bot/code_review_bot/analysis.py b/bot/code_review_bot/analysis.py index f6a9a6a7c..145717657 100644 --- a/bot/code_review_bot/analysis.py +++ b/bot/code_review_bot/analysis.py @@ -100,15 +100,22 @@ def publish_analysis_phabricator(payload, phabricator_api): elif mode == "fail:mercurial": extra_content = "" + developer_instructions = "" if build.missing_base_revision: extra_content = f" because the parent revision ({build.base_revision}) does not exist on mozilla-unified. If possible, you should publish that revision" + if "abort: uncommitted changes" in extras["message"]: + developer_instructions = "The patch will likely fail to land. Possible causes:" \ + "* A parent revision has been set in Phabricator after the patch had been submitted." \ + "Rebase the patch onto the new parent revision to resolve the issue." + if developer_instructions != "": + developer_instructions += "\n\n" failure = UnitResult( namespace="code-review", name="mercurial", result=UnitResultState.Fail, - details="WARNING: The code review bot failed to apply your patch{}.\n\n```{}```".format( - extra_content, extras["message"] + details="WARNING: The code review bot failed to apply your patch{}.\n\n{}```{}```".format( + extra_content, developer_instructions, extras["message"] ), format="remarkup", duration=extras.get("duration", 0),