From cb11de70988f5e4c6877db5f3aa3b4913978866d Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 2 Jan 2015 13:58:39 +0100 Subject: [PATCH] Relax prerelease requirements for pinned versions - references #487 --- RELEASE_NOTES.md | 3 +++ src/Paket.Core/DependencyChangeDetection.fs | 7 ++++--- src/Paket.Core/UpdateProcess.fs | 2 +- .../DependenciesFile/DependencyChangesSpecs.fs | 8 ++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 1fa5954002..12f1c15b4b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 0.20.21 - 02.01.2015 +* PERFORMANCE: Relax prerelease requirements for pinned versions - https://github.com/fsprojects/Paket/issues/487 + #### 0.20.20 - 02.01.2015 * PERFORMANCE: Don't enumerate all files, since we only need lib files - https://github.com/fsprojects/Paket/issues/487 diff --git a/src/Paket.Core/DependencyChangeDetection.fs b/src/Paket.Core/DependencyChangeDetection.fs index 87b6b5f750..1f385dfb53 100644 --- a/src/Paket.Core/DependencyChangeDetection.fs +++ b/src/Paket.Core/DependencyChangeDetection.fs @@ -18,8 +18,9 @@ let findChangesInDependenciesFile(dependenciesFile:DependenciesFile,lockFile:Loc [for t in lockFile.GetTopLevelDependencies() do let name = t.Key match directMap.TryFind name with - | Some range -> - if range.IsInRange t.Value.Version |> not then + | Some r -> + let vr = VersionRequirement(r.Range,PreReleaseStatus.All) + if vr.IsInRange t.Value.Version |> not then yield name // Modified | _ -> yield name // Removed ] @@ -30,7 +31,7 @@ let findChangesInDependenciesFile(dependenciesFile:DependenciesFile,lockFile:Loc added |> Set.union modified -let FixUnchangedDependencies (dependenciesFile:DependenciesFile) (oldLockFile:LockFile) = +let PinUnchangedDependencies (dependenciesFile:DependenciesFile) (oldLockFile:LockFile) = let changedDependencies = findChangesInDependenciesFile(dependenciesFile,oldLockFile) oldLockFile.ResolvedPackages diff --git a/src/Paket.Core/UpdateProcess.fs b/src/Paket.Core/UpdateProcess.fs index e1ece615b4..4c93bda9da 100644 --- a/src/Paket.Core/UpdateProcess.fs +++ b/src/Paket.Core/UpdateProcess.fs @@ -48,7 +48,7 @@ let SelectiveUpdate(dependenciesFile:DependenciesFile, force) = else let oldLockFile = LockFile.LoadFrom(lockFileName.FullName) - let dependenciesFile = DependencyChangeDetection.FixUnchangedDependencies dependenciesFile oldLockFile + let dependenciesFile = DependencyChangeDetection.PinUnchangedDependencies dependenciesFile oldLockFile let resolution = dependenciesFile.Resolve(force) LockFile.Create(lockFileName.FullName, dependenciesFile.Options, resolution.ResolvedPackages, oldLockFile.SourceFiles) diff --git a/tests/Paket.Tests/DependenciesFile/DependencyChangesSpecs.fs b/tests/Paket.Tests/DependenciesFile/DependencyChangesSpecs.fs index 3fcb299d3c..6255b144f5 100644 --- a/tests/Paket.Tests/DependenciesFile/DependencyChangesSpecs.fs +++ b/tests/Paket.Tests/DependenciesFile/DependencyChangesSpecs.fs @@ -35,7 +35,7 @@ nuget Castle.Windsor-log4net""" let cfg = DependenciesFile.FromCode(after) let lockFile = LockFile.Parse("",toLines lockFileData) - let newDependencies = DependencyChangeDetection.FixUnchangedDependencies cfg lockFile + let newDependencies = DependencyChangeDetection.PinUnchangedDependencies cfg lockFile newDependencies.DirectDependencies |> shouldEqual Map.empty @@ -71,7 +71,7 @@ nuget NUnit""" let cfg = DependenciesFile.FromCode(after) let lockFile = LockFile.Parse("",toLines lockFileData) - let newDependencies = DependencyChangeDetection.FixUnchangedDependencies cfg lockFile + let newDependencies = DependencyChangeDetection.PinUnchangedDependencies cfg lockFile let expected = Map.ofList ([(PackageName "Castle.Core", VersionRequirement (Specific(SemVer.Parse "3.3.3"),No)); @@ -117,7 +117,7 @@ nuget Castle.Windsor-log4net >= 3.3.0""" let cfg = DependenciesFile.FromCode(after) let lockFile = LockFile.Parse("",toLines lockFileData) - let newDependencies = DependencyChangeDetection.FixUnchangedDependencies cfg lockFile + let newDependencies = DependencyChangeDetection.PinUnchangedDependencies cfg lockFile let expected = Map.ofList ([(PackageName "Castle.Core", VersionRequirement (Specific(SemVer.Parse "3.3.3"),No)); @@ -162,7 +162,7 @@ nuget Castle.Windsor-log4net >= 3.4.0""" let cfg = DependenciesFile.FromCode(after) let lockFile = LockFile.Parse("",toLines lockFileData) - let newDependencies = DependencyChangeDetection.FixUnchangedDependencies cfg lockFile + let newDependencies = DependencyChangeDetection.PinUnchangedDependencies cfg lockFile let expected = Map.ofList ([(PackageName "Castle.Windsor-log4net", VersionRequirement (Minimum(SemVer.Parse "3.4.0"),No));])