Skip to content

Commit

Permalink
Relax prerelease requirements for pinned versions - references #487
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jan 2, 2015
1 parent 53b3a8d commit cb11de7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 4 additions & 3 deletions src/Paket.Core/DependencyChangeDetection.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/UpdateProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions tests/Paket.Tests/DependenciesFile/DependencyChangesSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));])
Expand Down

0 comments on commit cb11de7

Please sign in to comment.