Post a comment about a PR conflict#4901
Merged
premun merged 2 commits intodotnet:mainfrom May 31, 2025
Merged
Conversation
Another code path that was omitted in dotnet#4882 and which did not post a comment here: dotnet/runtime#115833
Contributor
There was a problem hiding this comment.
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
tryblock aroundMergeBackAsyncto catchProcessFailedExceptionon 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
ConflictInPrBranchExceptionis thrown and logged correctly when a merge conflict occurs.
await workBranch.MergeBackAsync(commitMessage);
adamzip
approved these changes
May 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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