Skip to content

Commit

Permalink
Merge pull request #660 from dotnet/fix588
Browse files Browse the repository at this point in the history
Fix `nbgv` dependencies
  • Loading branch information
AArnott committed Sep 23, 2021
2 parents 0b29e5a + 2b80c11 commit 2a3260a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
26 changes: 20 additions & 6 deletions src/nbgv/Program.cs
Expand Up @@ -215,9 +215,23 @@ private static Parser BuildCommandLine()
}
}
}, (MiddlewareOrder)(-3000)) // MiddlewareOrderInternal.ExceptionHandler so [parse] directive is accurate.
.UseExceptionHandler((ex, context) => PrintException(ex, context))
.Build();
}

private static void PrintException(Exception ex, InvocationContext context)
{
try
{
Console.Error.WriteLine("Unhandled exception: {0}", ex);
}
catch (Exception ex2)
{
Console.Error.WriteLine("Unhandled exception: {0}", ex.Message);
Console.Error.WriteLine("Unhandled exception while trying to print string version of the above exception: {0}", ex2);
}
}

private static int MainInner(string[] args)
{
try
Expand Down Expand Up @@ -347,16 +361,16 @@ private static int OnInstallCommand(string path, string version, IReadOnlyList<s
return (int)ExitCodes.OK;
}

private static int OnGetVersionCommand(string project, IReadOnlyList<string> metadata, string format, string variable, string commitIsh)
private static int OnGetVersionCommand(string project, IReadOnlyList<string> metadata, string format, string variable, string commitish)
{
if (string.IsNullOrEmpty(format))
{
format = DefaultOutputFormat;
}

if (string.IsNullOrEmpty(commitIsh))
if (string.IsNullOrEmpty(commitish))
{
commitIsh = DefaultRef;
commitish = DefaultRef;
}

string searchPath = GetSpecifiedOrCurrentDirectoryPath(project);
Expand All @@ -368,9 +382,9 @@ private static int OnGetVersionCommand(string project, IReadOnlyList<string> met
return (int)ExitCodes.NoGitRepo;
}

if (!context.TrySelectCommit(commitIsh))
if (!context.TrySelectCommit(commitish))
{
Console.Error.WriteLine("rev-parse produced no commit for {0}", commitIsh);
Console.Error.WriteLine("rev-parse produced no commit for {0}", commitish);
return (int)ExitCodes.BadGitRef;
}

Expand Down Expand Up @@ -759,7 +773,7 @@ private static async Task<string> GetLatestPackageVersionAsync(string packageId,
var providers = new List<Lazy<INuGetResourceProvider>>();
providers.AddRange(Repository.Provider.GetCoreV3()); // Add v3 API support

var sourceRepositoryProvider = new SourceRepositoryProvider(settings, providers);
var sourceRepositoryProvider = new SourceRepositoryProvider(new PackageSourceProvider(settings), providers);

// Select package sources based on NuGet.Config files or given options, as 'nuget.exe restore' command does
// See also 'DownloadCommandBase.GetPackageSources(ISettings)' at https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Clients/NuGet.CommandLine/Commands/DownloadCommandBase.cs
Expand Down
5 changes: 2 additions & 3 deletions src/nbgv/nbgv.csproj
Expand Up @@ -10,12 +10,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NuGet.PackageManagement" Version="4.9.3" NoWarn="NU1701" />
<PackageReference Include="NuGet.Resolver" Version="4.9.3" />
<PackageReference Include="NuGet.PackageManagement" Version="5.11.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
<PackageReference Include="Nerdbank.GitVersioning.LKG" Version="3.4.173-alpha" PrivateAssets="all" />
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0" />
<PackageReference Include="Microsoft.Build" Version="15.9.20" />
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 2a3260a

Please sign in to comment.