Support darc vmr reset from the source repo#6434
Open
Copilot wants to merge 12 commits into
Open
Conversation
Copilot
AI
changed the title
[WIP] Support darc vmr reset outside of vmr directory
Support Jun 23, 2026
darc vmr reset from the source repo
dkurepa
reviewed
Jun 23, 2026
dkurepa
reviewed
Jun 23, 2026
| // Default behavior: Target is in the format [mapping]:[sha] | ||
| var parts = _options.Target.Split(':', 2); | ||
| if (parts.Length != 2) | ||
| currentRepositoryTarget = await TryResolveTargetFromCurrentRepositoryAsync(); |
dkurepa
reviewed
Jun 23, 2026
| // When --build or --channel is provided, Target should only be the mapping name | ||
| mappingName = _options.Target; | ||
|
|
||
| if (string.IsNullOrWhiteSpace(mappingName)) |
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns darc vmr reset with darc vmr forwardflow by allowing reset to infer the target mapping and SHA from the current source repository context (so callers can run reset from the repo being synchronized and pass only --vmr).
Changes:
- Makes
Targetpositional argument optional fordarc vmr resetand documents the inferred-default behavior. - Adds inference logic to resolve mapping from
eng/Version.Details.xml<Source>and SHA from current repoHEADwhenTargetis omitted. - Adds the current repo path as an additional remote for the inferred mapping so reset can materialize the local commit into the VMR.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/Microsoft.DotNet.Darc/Darc/Options/VirtualMonoRepo/ResetCommandLineOptions.cs | Makes Target optional and updates help text to describe inferred behavior. |
| src/Microsoft.DotNet.Darc/Darc/Operations/VirtualMonoRepo/ResetOperation.cs | Implements target inference from the current repo and injects dependencies to read Version.Details and resolve HEAD SHA; adds an additional remote when inferred. |
Comment on lines
+305
to
+309
| catch (Exception ex) | ||
| { | ||
| _logger.LogDebug(ex, "Could not resolve a git repository root from '{path}'", Environment.CurrentDirectory); | ||
| return null; | ||
| } |
Comment on lines
+112
to
+117
| if (currentRepositoryTarget == null) | ||
| { | ||
| _logger.LogError( | ||
| "Target must be provided as [mapping]:[sha], or the command must be run from a source repository with a VMR Source tag."); | ||
| return Constants.ErrorCode; | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
dkurepa
reviewed
Jun 23, 2026
adamzip
reviewed
Jun 24, 2026
adamzip
reviewed
Jun 24, 2026
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.
darc vmr resetrequired an explicit[mapping]:[sha], unlikedarc vmr forwardflow, which can infer context from the current source repo. This change aligns reset with that workflow so vmr-sync callers can invoke reset from the repo being synchronized and only provide--vmr.CLI behavior
darc vmr resetto omit the positional target when invoked from a source repo.eng/Version.Details.xml<Source>tag.HEAD.Reset execution
[mapping]:[sha],--build, and--channelflows unchanged.Diagnostics
<Source>tag.#5973