diff --git a/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj index 249bebba97..49aa6e9a57 100644 --- a/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj +++ b/integrationtests/Paket.IntegrationTests/Paket.IntegrationTests.fsproj @@ -84,6 +84,10 @@ + + + + diff --git a/integrationtests/Paket.IntegrationTests/UpdatePackageSpecs.fs b/integrationtests/Paket.IntegrationTests/UpdatePackageSpecs.fs new file mode 100644 index 0000000000..82bd89dbe2 --- /dev/null +++ b/integrationtests/Paket.IntegrationTests/UpdatePackageSpecs.fs @@ -0,0 +1,33 @@ +module Paket.IntegrationTests.UpdatePackageSpecs + +open Fake +open System +open NUnit.Framework +open FsUnit +open System +open System.IO +open System.Diagnostics +open Paket +open Paket.Domain + +[] +let ``#1178 update with Mircosoft.* filter``() = + paket "update nuget Microsoft.* --filter" "i001178-update-with-regex" |> ignore + let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001178-update-with-regex","paket.lock")) + lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Castle.Windsor"].Version + |> shouldEqual (SemVer.Parse "2.5.1") + lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "NUnit"].Version + |> shouldEqual (SemVer.Parse "2.6.1") + lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Microsoft.AspNet.WebApi.SelfHost"].Version + |> shouldBeGreaterThan (SemVer.Parse "5.0.1") + +[] +let ``#1178 update with [MN].* --filter``() = + paket "update nuget [MN].* --filter" "i001178-update-with-regex" |> ignore + let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001178-update-with-regex","paket.lock")) + lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Castle.Windsor"].Version + |> shouldEqual (SemVer.Parse "2.5.1") + lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "NUnit"].Version + |> shouldBeGreaterThan (SemVer.Parse "2.6.1") + lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Microsoft.AspNet.WebApi.SelfHost"].Version + |> shouldBeGreaterThan (SemVer.Parse "5.0.1") \ No newline at end of file diff --git a/integrationtests/scenarios/i001178-update-with-regex/before/paket.dependencies b/integrationtests/scenarios/i001178-update-with-regex/before/paket.dependencies new file mode 100644 index 0000000000..7751109112 --- /dev/null +++ b/integrationtests/scenarios/i001178-update-with-regex/before/paket.dependencies @@ -0,0 +1,5 @@ +source https://nuget.org/api/v2 + +nuget Castle.Windsor +nuget NUnit +nuget Microsoft.AspNet.WebApi.SelfHost \ No newline at end of file diff --git a/integrationtests/scenarios/i001178-update-with-regex/before/paket.lock b/integrationtests/scenarios/i001178-update-with-regex/before/paket.lock new file mode 100644 index 0000000000..8760a9a741 --- /dev/null +++ b/integrationtests/scenarios/i001178-update-with-regex/before/paket.lock @@ -0,0 +1,21 @@ +NUGET + remote: https://nuget.org/api/v2 + specs: + Castle.Core (3.3.3) + Castle.Windsor (2.5.1) + Castle.Core (>= 2.5.1) + Microsoft.AspNet.WebApi.Client (5.2.3) + Microsoft.Net.Http (>= 2.2.22) - framework: portable-wp80+win+net45+wp81+wpa81 + Newtonsoft.Json (>= 6.0.4) - framework: portable-wp80+win+net45+wp81+wpa81, >= net45 + Microsoft.AspNet.WebApi.Core (5.0.0) + Microsoft.AspNet.WebApi.Client (>= 5.0.0) + Microsoft.AspNet.WebApi.SelfHost (5.0.1) + Microsoft.AspNet.WebApi.Core (>= 5.0.0 < 5.1) + Microsoft.Bcl (1.1.10) - framework: portable-wp80+win+net45+wp81+wpa81 + Microsoft.Bcl.Build (>= 1.0.14) + Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: portable-wp80+win+net45+wp81+wpa81 + Microsoft.Net.Http (2.2.29) - framework: portable-wp80+win+net45+wp81+wpa81 + Microsoft.Bcl (>= 1.1.10) + Microsoft.Bcl.Build (>= 1.0.14) + Newtonsoft.Json (7.0.1) - framework: portable-wp80+win+net45+wp81+wpa81, >= net45 + NUnit (2.6.1) diff --git a/src/Paket.Core/Domain.fs b/src/Paket.Core/Domain.fs index caf01eb3f7..0e32f51972 100644 --- a/src/Paket.Core/Domain.fs +++ b/src/Paket.Core/Domain.fs @@ -1,6 +1,7 @@ module Paket.Domain open System.IO +open System.Text.RegularExpressions /// Represents a NuGet package name [] @@ -32,6 +33,23 @@ type PackageName = /// Function to convert a string into a NuGet package name let PackageName(name:string) = PackageName.PackageName(name.Trim(),name.ToLowerInvariant().Trim()) +// Represents a filter of normalized package names +[] +type PackageFilter = +| PackageFilter of string + member this.regex = + match this with + | PackageFilter f -> + Regex("^" + f + "$", + RegexOptions.Compiled + ||| RegexOptions.CultureInvariant + ||| RegexOptions.IgnoreCase) + member this.Match (packageName : PackageName) = + this.regex.IsMatch (packageName.GetCompareString()) + override this.ToString() = + match this with + | PackageFilter filter -> filter + /// Represents a normalized group name [] [] diff --git a/src/Paket.Core/PackageResolver.fs b/src/Paket.Core/PackageResolver.fs index ac9e31c280..b8f16dcc41 100644 --- a/src/Paket.Core/PackageResolver.fs +++ b/src/Paket.Core/PackageResolver.fs @@ -187,8 +187,8 @@ type Resolved = { ResolvedSourceFiles : ModuleResolver.ResolvedSourceFile list } type UpdateMode = - | UpdatePackage of GroupName * PackageName | UpdateGroup of GroupName + | UpdateFiltered of GroupName * PackageFilter | Install | UpdateAll @@ -197,9 +197,9 @@ let Resolve(groupName:GroupName, sources, getVersionsF, getPackageDetailsF, stra tracefn "Resolving packages for group %O:" groupName let lastConflictReported = ref DateTime.Now - let startWithPackage = + let packageFilter = match updateMode with - | UpdatePackage(_,p) -> Some p + | UpdateFiltered (_, f) -> Some f | _ -> None let rootSettings = @@ -263,7 +263,7 @@ let Resolve(groupName:GroupName, sources, getVersionsF, getPackageDetailsF, stra match conflictHistory.TryGetValue d.Name with | true,c -> -c | _ -> 0 - if PackageRequirement.Compare(d,!currentMin,startWithPackage,boost,!currentBoost) = -1 then + if PackageRequirement.Compare(d,!currentMin,packageFilter,boost,!currentBoost) = -1 then currentMin := d currentBoost := boost !currentMin @@ -319,8 +319,8 @@ let Resolve(groupName:GroupName, sources, getVersionsF, getPackageDetailsF, stra match currentRequirement.Parent.IsRootRequirement(), Set.count currentRequirements with | true, 1 -> ResolverStrategy.Max | _ -> combined - | UpdatePackage (g, p) -> - match groupName = g && currentRequirement.Name = p with + | UpdateFiltered (g, f) -> + match groupName = g && f.Match currentRequirement.Name with | true -> ResolverStrategy.Max | false -> combined diff --git a/src/Paket.Core/PublicAPI.fs b/src/Paket.Core/PublicAPI.fs index 67e20f2e88..21238a431a 100644 --- a/src/Paket.Core/PublicAPI.fs +++ b/src/Paket.Core/PublicAPI.fs @@ -198,6 +198,20 @@ type Dependencies(dependenciesFileName: string) = Common = InstallerOptions.CreateLegacyOptions(force, hard, withBindingRedirects, createNewBindingFiles, semVerUpdateMode) NoInstall = installAfter |> not })) + /// Update a filtered set of packages + member this.UpdateFilteredPackages(groupName: string option, package: string, version: string option, force: bool, hard: bool, withBindingRedirects: bool, createNewBindingFiles:bool, installAfter: bool, semVerUpdateMode): unit = + let groupName = + match groupName with + | None -> Constants.MainDependencyGroup + | Some name -> GroupName name + + Utils.RunInLockedAccessMode( + this.RootPath, + fun () -> UpdateProcess.UpdateFilteredPackages(dependenciesFileName, groupName, PackageName package, version, + { UpdaterOptions.Default with + Common = InstallerOptions.CreateLegacyOptions(force, hard, withBindingRedirects, createNewBindingFiles, semVerUpdateMode) + NoInstall = installAfter |> not })) + /// Updates the given package. member this.UpdatePackage(groupName, package: string, version: string option, force: bool, hard: bool, semVerUpdateMode): unit = this.UpdatePackage(groupName, package, version, force, hard, false, false, true, semVerUpdateMode) diff --git a/src/Paket.Core/Requirements.fs b/src/Paket.Core/Requirements.fs index b666a34743..1544eec8c7 100644 --- a/src/Paket.Core/Requirements.fs +++ b/src/Paket.Core/Requirements.fs @@ -433,15 +433,15 @@ type PackageRequirement = member this.Depth = this.Graph.Length - static member Compare(x,y,startWithPackage:PackageName option,boostX,boostY) = + static member Compare(x,y,startWithPackage:PackageFilter option,boostX,boostY) = if x = y then 0 else seq { yield compare (not x.VersionRequirement.Range.IsGlobalOverride,x.Depth) (not y.VersionRequirement.Range.IsGlobalOverride,y.Depth) yield match startWithPackage with - | Some name when name = x.Name -> -1 - | Some name when name = y.Name -> 1 + | Some filter when filter.Match x.Name -> -1 + | Some filter when filter.Match y.Name -> 1 | _ -> 0 yield -compare x.ResolverStrategy y.ResolverStrategy yield compare boostX boostY diff --git a/src/Paket.Core/UpdateProcess.fs b/src/Paket.Core/UpdateProcess.fs index eda3ede1ad..45a52b6759 100644 --- a/src/Paket.Core/UpdateProcess.fs +++ b/src/Paket.Core/UpdateProcess.fs @@ -73,6 +73,19 @@ let selectiveUpdate force getSha1 getSortedVersionsF getPackageDetailsF (lockFil dependenciesFile.Groups |> Map.filter (fun k _ -> k = groupName) + changes,groups + | UpdateFiltered (groupName, filter) -> + let changes = + lockFile.GetGroupedResolution() + |> Seq.map (fun k -> k.Key) + |> Seq.filter (fun (g,_) -> g = groupName) + |> Seq.filter (fun (_, p) -> filter.Match p) + |> Set.ofSeq + + let groups = + dependenciesFile.Groups + |> Map.filter (fun k _ -> k = groupName) + changes,groups | Install -> let nuGetChanges = DependencyChangeDetection.findNuGetChangesInDependenciesFile(dependenciesFile,lockFile) @@ -116,16 +129,6 @@ let selectiveUpdate force getSha1 getSortedVersionsF getPackageDetailsF (lockFil |> Map.filter hasChanges nuGetChanges,groups - | UpdatePackage(groupName,packageName) -> - let changes = - lockFile.GetAllNormalizedDependenciesOf(groupName,packageName) - |> Set.ofSeq - - let groups = - dependenciesFile.Groups - |> Map.filter (fun key _ -> key = groupName) - - changes,groups let preferredVersions = DependencyChangeDetection.GetPreferredNuGetVersions lockFile @@ -200,7 +203,24 @@ let UpdatePackage(dependenciesFileName, groupName, packageName : PackageName, ne tracefn "Updating %O in %s group %O" packageName dependenciesFileName groupName dependenciesFile - SmartInstall(dependenciesFile, UpdatePackage(groupName,packageName), options) + let filter = PackageFilter (packageName.ToString().Replace(".", "\\.")) + + SmartInstall(dependenciesFile, UpdateFiltered(groupName,filter), options) + +/// Update a filtered list of packages +let UpdateFilteredPackages(dependenciesFileName, groupName, packageName : PackageName, newVersion, options : UpdaterOptions) = + let dependenciesFile = DependenciesFile.ReadFromFile(dependenciesFileName) + + let filter = PackageFilter <| packageName.ToString() + + let dependenciesFile = + match newVersion with + | Some v -> dependenciesFile.UpdatePackageVersion(groupName,packageName, v) + | None -> + tracefn "Updating %O in %s group %O" packageName dependenciesFileName groupName + dependenciesFile + + SmartInstall(dependenciesFile, UpdateFiltered(groupName, filter), options) /// Update a single group command let UpdateGroup(dependenciesFileName, groupName, options : UpdaterOptions) = diff --git a/src/Paket/Commands.fs b/src/Paket/Commands.fs index 12e9139bd3..a10451dcc6 100644 --- a/src/Paket/Commands.fs +++ b/src/Paket/Commands.fs @@ -221,6 +221,7 @@ type UpdateArgs = | Keep_Major | Keep_Minor | Keep_Patch + | Filter with interface IArgParserTemplate with member this.Usage = @@ -236,6 +237,7 @@ with | Keep_Major -> "Allows only updates that are not changing the major version of the NuGet packages." | Keep_Minor -> "Allows only updates that are not changing the minor version of the NuGet packages." | Keep_Patch -> "Allows only updates that are not changing the patch version of the NuGet packages." + | Filter -> "Treat the nuget parameter as a regex to filter packages rather than an exact match." type FindPackagesArgs = | [] SearchText of string diff --git a/src/Paket/Program.fs b/src/Paket/Program.fs index c6c03e8702..cfb4787263 100644 --- a/src/Paket/Program.fs +++ b/src/Paket/Program.fs @@ -194,11 +194,15 @@ let update (results : ParseResults<_>) = if results.Contains <@ UpdateArgs.Keep_Minor @> then SemVerUpdateMode.KeepMinor else if results.Contains <@ UpdateArgs.Keep_Major @> then SemVerUpdateMode.KeepMajor else SemVerUpdateMode.NoRestriction + let filter = results.Contains <@ UpdateArgs.Filter @> match results.TryGetResult <@ UpdateArgs.Nuget @> with | Some packageName -> let version = results.TryGetResult <@ UpdateArgs.Version @> - Dependencies.Locate().UpdatePackage(group, packageName, version, force, hard, withBindingRedirects, createNewBindingFiles, noInstall |> not, semVerUpdateMode) + if filter then + Dependencies.Locate().UpdateFilteredPackages(group, packageName, version, force, hard, withBindingRedirects, createNewBindingFiles, noInstall |> not, semVerUpdateMode) + else + Dependencies.Locate().UpdatePackage(group, packageName, version, force, hard, withBindingRedirects, createNewBindingFiles, noInstall |> not, semVerUpdateMode) | _ -> match group with | Some groupName -> diff --git a/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs b/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs index e5a194e977..5bee6fb73b 100644 --- a/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs +++ b/tests/Paket.Tests/Resolver/GlobalOptimisticStrategySpecs.fs @@ -119,7 +119,7 @@ let ``should update to lastest when updating all``() = let ``should respect overrides when updating single package``() = let resolved = DependenciesFile.FromCode(config6) - |> resolve graph2 (UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Windsor-NLog")) + |> resolve graph2 (UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Windsor-NLog")) getVersion resolved.[PackageName "Castle.Windsor-NLog"] |> shouldEqual "3.3.0" getVersion resolved.[PackageName "Castle.Core-NLog"] |> shouldEqual "3.3.1" getVersion resolved.[PackageName "Castle.Core"] |> shouldEqual "3.3.1" diff --git a/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs b/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs index 120307cc93..9e6a2a22e4 100644 --- a/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs +++ b/tests/Paket.Tests/Resolver/GlobalPessimisticStrategySpecs.fs @@ -135,7 +135,7 @@ let ``should favor strategy override when updating all``() = let ``should respect overrides when updating single package``() = let resolved = DependenciesFile.FromCode(config6) - |> resolve graph2 (UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Windsor-NLog")) + |> resolve graph2 (UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Windsor-NLog")) getVersion resolved.[PackageName "Castle.Windsor-NLog"] |> shouldEqual "3.3.0" getVersion resolved.[PackageName "Castle.Core-NLog"] |> shouldEqual "3.3.0" getVersion resolved.[PackageName "Castle.Core"] |> shouldEqual "3.3.1" diff --git a/tests/Paket.Tests/UpdateProcessSpecs.fs b/tests/Paket.Tests/UpdateProcessSpecs.fs index dd4bf89bd7..2bd6f0b548 100644 --- a/tests/Paket.Tests/UpdateProcessSpecs.fs +++ b/tests/Paket.Tests/UpdateProcessSpecs.fs @@ -155,7 +155,7 @@ let ``SelectiveUpdate updates a single package``() = let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "FAKE")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "FAKE")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -182,7 +182,7 @@ let ``SelectiveUpdate updates a single constrained package``() = let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -210,7 +210,7 @@ let ``SelectiveUpdate updates a single package with constrained dependency in de let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -264,7 +264,7 @@ let ``SelectiveUpdate removes a dependency when it updates a single package and let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -292,7 +292,7 @@ let ``SelectiveUpdate does not update when a dependency constrain is not met``() let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() |> Seq.map (fun (KeyValue (_,resolved)) -> (string resolved.Name, string resolved.Version)) @@ -319,7 +319,7 @@ let ``SelectiveUpdate considers package name case difference``() = let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -348,26 +348,10 @@ let ``SelectiveUpdate conflicts when a dependency is contrained``() = (fun () -> selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction |> ignore) |> shouldFail -[] -let ``SelectiveUpdate does not update any package when package does not exist``() = - - let dependenciesFile = DependenciesFile.FromCode("""source http://nuget.org/api/v2 - - nuget Castle.Core-log4net - nuget FAKE""") - - try - selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "package")) SemVerUpdateMode.NoRestriction - |> ignore - failwith "This pont should not be reached" - with - | exn when exn.Message <> "This pont should not be reached" -> () - [] let ``SelectiveUpdate generates paket.lock correctly``() = @@ -379,7 +363,7 @@ let ``SelectiveUpdate generates paket.lock correctly``() = let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core")) SemVerUpdateMode.NoRestriction let result = String.Join @@ -411,11 +395,11 @@ let ``SelectiveUpdate does not update when package conflicts with a transitive d nuget FAKE nuget log4net""") - let packageName = PackageName "log4net" + let packageFilter = PackageFilter "log4net" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -482,11 +466,11 @@ let ``SelectiveUpdate updates package that conflicts with a transitive dependenc nuget log4f nuget Ninject.Extensions.Logging.Log4net""") - let packageName = PackageName "log4f" + let packageFilter = PackageFilter "log4f" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph2) (PackageDetailsFromGraph graph2) lockFile2 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -513,11 +497,11 @@ let ``SelectiveUpdate updates package that conflicts with a transitive dependenc nuget log4f nuget Ninject.Extensions.Logging.Log4net""") - let packageName = PackageName "Ninject.Extensions.Logging.Log4net" + let packageFilter = PackageFilter "Ninject\\.Extensions\\.Logging\\.Log4net" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph2) (PackageDetailsFromGraph graph2) lockFile2 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -569,11 +553,11 @@ let ``SelectiveUpdate updates package that conflicts with a transitive dependenc nuget Ninject.Extensions.Logging.Log4net nuget Ninject.Extensions.Interception""") - let packageName = PackageName "Ninject.Extensions.Logging.Log4net" + let packageFilter = PackageFilter "Ninject\\.Extensions\\.Logging\\.Log4net" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph3) (PackageDetailsFromGraph graph3) lockFile3 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -602,11 +586,11 @@ let ``SelectiveUpdate does not conflict with a transitive dependency of another nuget Ninject.Extensions.Logging.Log4net nuget Ninject.Extensions.Interception""") - let packageName = PackageName "Ninject" + let packageFilter = PackageFilter "Ninject" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph3) (PackageDetailsFromGraph graph3) lockFile3 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -634,11 +618,11 @@ let ``SelectiveUpdate updates package that conflicts with a deep transitive depe nuget Ninject.Extensions.Logging.Log4net nuget Ninject.Extensions.Interception""") - let packageName = PackageName "Ninject.Extensions.Interception" + let packageFilter = PackageFilter "Ninject\\.Extensions\\.Interception" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph3) (PackageDetailsFromGraph graph3) lockFile3 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -686,11 +670,11 @@ let ``SelectiveUpdate updates package that conflicts with a deep transitive depe nuget Ninject.Extensions.Logging.Log4net.Deep""") - let packageName = PackageName "Ninject.Extensions.Logging.Log4net.Deep" + let packageFilter = PackageFilter "Ninject\\.Extensions\\.Logging\\.Log4net\\.Deep" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph4) (PackageDetailsFromGraph graph4) lockFile4 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -736,11 +720,11 @@ let ``SelectiveUpdate updates package that conflicts with transitive dependency nuget Ninject.Extensions.Interception nuget Ninject.Extensions.Logging""") - let packageName = PackageName "Ninject.Extensions.Logging" + let packageFilter = PackageFilter "Ninject\\.Extensions\\.Logging" let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph5) (PackageDetailsFromGraph graph5) lockFile5 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, packageName)) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, packageFilter)) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -917,7 +901,7 @@ let ``SelectiveUpdate updates package from a specific group``() = let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(GroupName "Group", PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(GroupName "Group", PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -953,7 +937,7 @@ let ``SelectiveUpdate does not remove a dependency from group when it is a top-l let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(GroupName "Group", PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(GroupName "Group", PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -988,7 +972,7 @@ let ``SelectiveUpdate updates package from main group``() = let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Castle.Core-log4net")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Castle\\.Core-log4net")) SemVerUpdateMode.NoRestriction let result = groupMap lockFile @@ -1033,7 +1017,7 @@ let ``SelectiveUpdate updates package that has a new dependent package that also let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph7) (PackageDetailsFromGraph graph7) lockFile7 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "Package")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "Package")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -1067,7 +1051,7 @@ let ``SelectiveUpdate updates early package that has a new dependent package tha let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph7) (PackageDetailsFromGraph graph7) lockFile8 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(Constants.MainDependencyGroup, PackageName "APackage")) SemVerUpdateMode.NoRestriction + (PackageResolver.UpdateMode.UpdateFiltered(Constants.MainDependencyGroup, PackageFilter "APackage")) SemVerUpdateMode.NoRestriction let result = lockFile.GetGroupedResolution() @@ -1099,7 +1083,7 @@ let ``SelectiveUpdate with SemVerUpdateMode.Minor updates package from a specifi let lockFile = selectiveUpdate true noSha1 (VersionsFromGraph graph) (PackageDetailsFromGraph graph) lockFile6 dependenciesFile - (PackageResolver.UpdateMode.UpdatePackage(GroupName "Group", PackageName "Castle.Core-log4net")) SemVerUpdateMode.KeepMinor + (PackageResolver.UpdateMode.UpdateFiltered(GroupName "Group", PackageFilter "Castle.Core-log4net")) SemVerUpdateMode.KeepMinor let result = groupMap lockFile