Skip to content

Post a comment about a PR conflict#4901

Merged
premun merged 2 commits intodotnet:mainfrom
premun:prvysoky/conflict-message
May 31, 2025
Merged

Post a comment about a PR conflict#4901
premun merged 2 commits intodotnet:mainfrom
premun:prvysoky/conflict-message

Conversation

@premun
Copy link
Copy Markdown
Member

@premun premun commented May 30, 2025

This PR does the same as #4882 where another code path was omitted and which did not post a comment here: dotnet/runtime#115833

#4854

Another code path that was omitted in dotnet#4882 and which did not post a comment here: dotnet/runtime#115833
Copilot AI review requested due to automatic review settings May 30, 2025 12:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds handling for merge conflicts when merging a work branch back into the main branch by wrapping the merge call in a try/catch that throws a specialized exception.

  • Introduces a try block around MergeBackAsync to catch ProcessFailedException on merge conflicts
  • Logs a warning when a conflict is detected and throws ConflictInPrBranchException
  • Preserves existing behavior for non-conflict failures
Comments suppressed due to low confidence (2)

src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrBackflower.cs:379

  • [nitpick] Placeholder {mainBranch} could be confusing since it represents the head branch; consider renaming the placeholder to {headBranch} or renaming the variable for consistency.
_logger.LogWarning("Failed to merge back the work branch {branchName} into {mainBranch}: {error}",

src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrBackflower.cs:375

  • No tests cover the merge conflict scenario introduced by this try/catch block; consider adding a unit or integration test to validate that ConflictInPrBranchException is thrown and logged correctly when a merge conflict occurs.
await workBranch.MergeBackAsync(commitMessage);

Comment thread src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrBackflower.cs Outdated
@premun premun requested a review from adamzip May 30, 2025 12:59
@premun premun merged commit e90b575 into dotnet:main May 31, 2025
9 checks passed
@premun premun deleted the prvysoky/conflict-message branch June 10, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants