Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project hash to manifest metadata and warn when manifest and project are out of sync #2815

Merged
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Fredrik Ekre <[email protected]>
  • Loading branch information
IanButterworth and fredrikekre authored Nov 3, 2021
commit 2ba709546264b493e0d265d4174916abfff3734f
5 changes: 2 additions & 3 deletions src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ Base.@kwdef mutable struct Compat
val::VersionSpec
str::String
end
Base.hash(t::Compat, h::UInt) = foldr(hash, [t.val, t.str], init=h)

Base.@kwdef mutable struct Project
other::Dict{String,Any} = Dict{String,Any}()
Expand All @@ -240,8 +239,8 @@ Base.hash(t::Project, h::UInt) = foldr(hash, [getfield(t, x) for x in fieldnames
# only hash the deps and compat fields as they are the only fields that affect a resolve
function project_resolve_hash(t::Project, h::UInt = UInt(0))
iob = IOBuffer()
println(iob, t.deps)
println(iob, t.compat)
foreach(((name, uuid),) -> println(io, name, "=", uuid), sort!(collect(t.deps); by=first))
foreach(((name, compat),) -> println(name, "=", compat.val), sort!(collect(t.compat); by=first))
return bytes2hex(sha1(seekstart(iob)))
end

Expand Down