diff --git a/src/Operations.jl b/src/Operations.jl index a9b3d54674..013d163e58 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -1636,12 +1636,14 @@ print_single(io::IO, pkg::PackageSpec) = printstyled(io, stat_rep(pkg); color=:w is_instantiated(::Nothing) = false is_instantiated(x::PackageSpec) = x.version != VersionSpec() || is_stdlib(x.uuid) +# Compare an old and new node of the dependency graph and print a single line to summarize the change function print_diff(io::IO, old::Union{Nothing,PackageSpec}, new::Union{Nothing,PackageSpec}) if !is_instantiated(old) && is_instantiated(new) printstyled(io, "+ $(stat_rep(new))"; color=:light_green) elseif !is_instantiated(new) printstyled(io, "- $(stat_rep(old))"; color=:light_red) - elseif is_tracking_registry(old) && is_tracking_registry(new) && new.version isa VersionNumber && old.version isa VersionNumber + elseif is_tracking_registry(old) && is_tracking_registry(new) && + new.version isa VersionNumber && old.version isa VersionNumber && new.version != old.version if new.version > old.version printstyled(io, "↑ $(stat_rep(old)) ⇒ $(stat_rep(new; name=false))"; color=:light_yellow) else diff --git a/test/new.jl b/test/new.jl index 41056278e6..ae17526fed 100644 --- a/test/new.jl +++ b/test/new.jl @@ -1954,6 +1954,21 @@ end @test occursin(r"\[7876af07\] - Example v\d\.\d\.\d", output) @test occursin(r"Updating `.+Manifest.toml`", output) @test occursin(r"\[7876af07\] - Example v\d\.\d\.\d", output) + + # Pinning a registered package + Pkg.add("Example") + Pkg.pin("Example"; io=io) + output = String(take!(io)) + @test occursin(r"Updating `.+Project.toml`", output) + @test occursin(r"\[7876af07\] ~ Example v\d\.\d\.\d ⇒ v\d\.\d\.\d ⚲", output) + @test occursin(r"Updating `.+Manifest.toml`", output) + + # Free a pinned package + Pkg.free("Example"; io=io) + output = String(take!(io)) + @test occursin(r"Updating `.+Project.toml`", output) + @test occursin(r"\[7876af07\] ~ Example v\d\.\d\.\d ⚲ ⇒ v\d\.\d\.\d", output) + @test occursin(r"Updating `.+Manifest.toml`", output) end # Project Status API isolate(loaded_depot=true) do