Skip to content

darc vmr cherry-pick does not work when not run from VMR, even with --vmr #6017

@mmitche

Description

@mmitche

When attempting to cherry-pick from a directory to the VMR, it is not obvious that the command must be run from the VMR directory. Failure to do so will yield a somewhat cryptic error like:

fail: Cherry-pick operation failed: Could not find file 'C:\r\runtime\src\source-mappings.json'.
dbug: System.IO.FileNotFoundException: Could not find file 'C:\r\runtime\src\source-mappings.json'.

This doesn't say what it actually means: That what it thinks it's cherry-picking to is not a VMR. The error messages in this case should be very clear, and include hints. the tool has detected that the cherry-picking operation is "starting from the VMR". It should be able to tell the user that the target (current directory is not a VMR). Better yet, it would be good for the command to say something like:

info: Cherry-picking <commit> from repository (<source>) -> VMR (<expected vmr dir>)
info: Detected source mapping name: runtime
fail: Cherry-pick operation failed: Could not find file 'C:\r\runtime\src\source-mappings.json'. Are you sure that <expected vmr dir> is the VMR? Operation should be run from VMR dir or with --vmr

Furthermore, passing --vmr does not work. For example:

e C:\r\runtime --commit 19e7456131cad3ad17cd16871f928d06e7e1b391
info: Cherry-pick operation starting from repository
info: Detected mapping name: runtime
fail: Cherry-pick operation failed: Could not find file 'C:\r\runtime\src\source-mappings.json'.
dbug: System.IO.FileNotFoundException: Could not find file 'C:\r\runtime\src\source-mappings.json'.
      File name: 'C:\r\runtime\src\source-mappings.json'
         at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
         at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
         at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
         at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
         at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
         at System.IO.File.AsyncStreamReader(String path, Encoding encoding)
         at System.IO.File.InternalReadAllTextAsync(String path, Encoding encoding, CancellationToken cancellationToken)
         at Microsoft.DotNet.DarcLib.VirtualMonoRepo.SourceMappingParser.ParseMappings(String mappingFilePath) in /_/src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/SourceMappingParser.cs:line 40
         at Microsoft.DotNet.Darc.Operations.VirtualMonoRepo.CherryPickOperation.ExecuteInternalAsync() in /_/src/Microsoft.DotNet.Darc/Darc/Operations/VirtualMonoRepo/CherryPickOperation.cs:line 84
         at Microsoft.DotNet.Darc.Operations.VirtualMonoRepo.CherryPickOperation.ExecuteAsync() in /_/src/Microsoft.DotNet.Darc/Darc/Operations/VirtualMonoRepo/CherryPickOperation.cs:line 49

This needs to be fixed.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions