diff --git a/src/Paket.Core/PackageAnalysis/Why.fs b/src/Paket.Core/PackageAnalysis/Why.fs index f2c74c3415..36fc2c3767 100644 --- a/src/Paket.Core/PackageAnalysis/Why.fs +++ b/src/Paket.Core/PackageAnalysis/Why.fs @@ -18,15 +18,19 @@ and LblPathNode<'a> = | LblPathLeaf of PackageName * 'a module AdjLblGraph = - let rec paths start stop visited (g: AdjLblGraph<_>) : list> = - let adjacents = - g.[start] - |> Seq.filter (fun kv -> not (Set.contains kv.Key visited)) - [ for kv in adjacents do - let n, lbl = kv.Key, kv.Value - if n = stop then yield (start, LblPathLeaf (stop, lbl)) - for path in paths n stop (Set.add n visited) g do - yield (start, LblPathNode path)] + let paths start stop (visited:HashSet<_>) (g: AdjLblGraph<_>) : list> = + let rec paths start stop (g: AdjLblGraph<_>) : list> = + [ for kv in g.[start] do + match visited.Add kv.Key with + | false -> () + | true -> + if kv.Key = stop then + yield (start, LblPathLeaf (stop, kv.Value)) + + for path in paths kv.Key stop g do + yield (start, LblPathNode path)] + + paths start stop g let depGraph (res : PackageResolver.PackageResolution) : AdjLblGraph<_> = res @@ -77,6 +81,7 @@ module DependencyChain = sprintf "%s -%s%s" (formatName name (i+1)) (formatVerReq vr) (formatFxReq fr) | LblPathLeaf (name,_), false -> formatName name (i+1) + sprintf "%s%s%s" (formatName name i) Environment.NewLine rest format' 0 c @@ -145,7 +150,7 @@ module Reason = let chains = topLevelDeps |> Set.toList - |> List.collect (fun p -> AdjLblGraph.paths p packageName Set.empty graph) + |> List.collect (fun p -> AdjLblGraph.paths p packageName (HashSet<_>()) graph) match Set.contains packageName directDeps, Set.contains packageName topLevelDeps with | true, true -> Result.Ok ((TopLevel, group.Resolution), []) diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index e616e324cf..2fae9ef063 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -33,9 +33,9 @@ Project install C:\temp\Gu.Reactive - restore --group Build + why ncrontab C:\proj\Paket - D:\temp\repronu110\ + D:\code\bookstore true